radiant-docs 0.1.7 → 0.1.8
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 +28 -5
- package/package.json +3 -3
- package/template/astro.config.mjs +76 -3
- package/template/package-lock.json +924 -737
- package/template/package.json +7 -5
- package/template/scripts/generate-og-images.mjs +335 -0
- package/template/scripts/generate-og-metadata.mjs +173 -0
- package/template/scripts/rewrite-static-asset-host.mjs +408 -0
- package/template/scripts/stamp-image-versions.mjs +277 -0
- package/template/scripts/stamp-og-image-versions.mjs +199 -0
- package/template/scripts/stamp-pagefind-runtime-version.mjs +140 -0
- package/template/src/assets/fonts/geist-mono/cyrillic.woff2 +0 -0
- package/template/src/assets/fonts/geist-mono/latin-ext.woff2 +0 -0
- package/template/src/assets/fonts/geist-mono/latin.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/canadian-aboriginal.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/cherokee.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/latin-ext.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/latin.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/math.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/nushu.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/symbols.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/syriac.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/tifinagh.woff2 +0 -0
- package/template/src/assets/fonts/google-sans-flex/vietnamese.woff2 +0 -0
- package/template/src/components/Footer.astro +94 -0
- package/template/src/components/Header.astro +11 -66
- package/template/src/components/LogoLink.astro +103 -0
- package/template/src/components/MdxPage.astro +126 -11
- package/template/src/components/OpenApiPage.astro +1036 -69
- package/template/src/components/Search.astro +0 -2
- package/template/src/components/SidebarDropdown.astro +34 -14
- package/template/src/components/SidebarGroup.astro +3 -6
- package/template/src/components/SidebarLink.astro +22 -12
- package/template/src/components/SidebarMenu.astro +19 -16
- package/template/src/components/SidebarSegmented.astro +99 -0
- package/template/src/components/SidebarSubgroup.astro +12 -12
- package/template/src/components/ThemeSwitcher.astro +30 -7
- package/template/src/components/endpoint/PlaygroundBar.astro +32 -36
- package/template/src/components/endpoint/PlaygroundButton.astro +40 -4
- package/template/src/components/endpoint/PlaygroundField.astro +1068 -22
- package/template/src/components/endpoint/PlaygroundForm.astro +559 -61
- package/template/src/components/endpoint/RequestSnippets.astro +342 -193
- package/template/src/components/endpoint/ResponseDisplay.astro +161 -147
- package/template/src/components/endpoint/ResponseFieldTree.astro +134 -0
- package/template/src/components/endpoint/ResponseFields.astro +711 -68
- package/template/src/components/endpoint/ResponseSnippets.astro +299 -173
- package/template/src/components/sidebar/SidebarEndpointLink.astro +1 -1
- package/template/src/components/ui/CodeLanguageIcon.astro +19 -0
- package/template/src/components/ui/CodeTabEdge.astro +79 -0
- package/template/src/components/ui/Field.astro +103 -20
- package/template/src/components/ui/Icon.astro +32 -0
- package/template/src/components/ui/ListChevronsToggle.astro +31 -0
- package/template/src/components/ui/Tag.astro +1 -1
- package/template/src/components/user/{Accordian.astro → Accordion.astro} +6 -6
- package/template/src/components/user/Callout.astro +5 -9
- package/template/src/components/user/CodeBlock.astro +400 -0
- package/template/src/components/user/CodeGroup.astro +225 -0
- package/template/src/components/user/ComponentPreview.astro +1 -0
- package/template/src/components/user/ComponentPreviewBlock.astro +181 -0
- package/template/src/components/user/Image.astro +132 -0
- package/template/src/components/user/Steps.astro +1 -3
- package/template/src/components/user/Tabs.astro +2 -2
- package/template/src/content.config.ts +1 -0
- package/template/src/layouts/Layout.astro +109 -8
- package/template/src/lib/code/code-block.ts +546 -0
- package/template/src/lib/frontmatter-schema.ts +8 -7
- package/template/src/lib/mdx/remark-code-block-component.ts +342 -0
- package/template/src/lib/mdx/remark-demote-h1.ts +16 -0
- package/template/src/lib/pagefind.ts +19 -5
- package/template/src/lib/routes.ts +49 -31
- package/template/src/lib/utils.ts +20 -0
- package/template/src/lib/validation.ts +638 -200
- package/template/src/pages/[...slug].astro +18 -5
- package/template/src/styles/geist-mono.css +33 -0
- package/template/src/styles/global.css +89 -84
- package/template/src/styles/google-sans-flex.css +143 -0
- package/template/ec.config.mjs +0 -51
- /package/template/src/components/user/{AccordianGroup.astro → AccordionGroup.astro} +0 -0
|
@@ -8,6 +8,12 @@ interface Props {
|
|
|
8
8
|
required?: boolean;
|
|
9
9
|
optional?: boolean;
|
|
10
10
|
enum?: (string | number)[];
|
|
11
|
+
minLength?: number;
|
|
12
|
+
maxLength?: number;
|
|
13
|
+
minimum?: number;
|
|
14
|
+
maximum?: number;
|
|
15
|
+
exclusiveMinimum?: number;
|
|
16
|
+
exclusiveMaximum?: number;
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
const {
|
|
@@ -17,53 +23,130 @@ const {
|
|
|
17
23
|
required,
|
|
18
24
|
optional,
|
|
19
25
|
enum: enumValues,
|
|
26
|
+
minLength,
|
|
27
|
+
maxLength,
|
|
28
|
+
minimum,
|
|
29
|
+
maximum,
|
|
30
|
+
exclusiveMinimum,
|
|
31
|
+
exclusiveMaximum,
|
|
20
32
|
} = Astro.props;
|
|
21
33
|
|
|
22
34
|
const formattedDescription = description
|
|
23
35
|
? await renderMarkdown(description)
|
|
24
36
|
: null;
|
|
37
|
+
const hasExclusiveMinimum = typeof exclusiveMinimum === "number";
|
|
38
|
+
const hasInclusiveMinimum = typeof minimum === "number";
|
|
39
|
+
const hasExclusiveMaximum = typeof exclusiveMaximum === "number";
|
|
40
|
+
const hasInclusiveMaximum = typeof maximum === "number";
|
|
41
|
+
|
|
42
|
+
const lowerBound = hasExclusiveMinimum
|
|
43
|
+
? exclusiveMinimum
|
|
44
|
+
: hasInclusiveMinimum
|
|
45
|
+
? minimum
|
|
46
|
+
: undefined;
|
|
47
|
+
const upperBound = hasExclusiveMaximum
|
|
48
|
+
? exclusiveMaximum
|
|
49
|
+
: hasInclusiveMaximum
|
|
50
|
+
? maximum
|
|
51
|
+
: undefined;
|
|
52
|
+
|
|
53
|
+
let numericRangeLabel: string | undefined;
|
|
54
|
+
if (lowerBound !== undefined && upperBound !== undefined) {
|
|
55
|
+
const lowerOperator = hasExclusiveMinimum ? "<" : "<=";
|
|
56
|
+
const upperOperator = hasExclusiveMaximum ? "<" : "<=";
|
|
57
|
+
numericRangeLabel = `${lowerBound} ${lowerOperator} value ${upperOperator} ${upperBound}`;
|
|
58
|
+
} else if (lowerBound !== undefined) {
|
|
59
|
+
const lowerOperator = hasExclusiveMinimum ? ">" : ">=";
|
|
60
|
+
numericRangeLabel = `value ${lowerOperator} ${lowerBound}`;
|
|
61
|
+
} else if (upperBound !== undefined) {
|
|
62
|
+
const upperOperator = hasExclusiveMaximum ? "<" : "<=";
|
|
63
|
+
numericRangeLabel = `value ${upperOperator} ${upperBound}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const hasMinLength = typeof minLength === "number";
|
|
67
|
+
const hasMaxLength = typeof maxLength === "number";
|
|
68
|
+
let stringLengthLabel: string | undefined;
|
|
69
|
+
if (hasMinLength && hasMaxLength) {
|
|
70
|
+
stringLengthLabel = `${minLength} <= length <= ${maxLength}`;
|
|
71
|
+
} else if (hasMinLength) {
|
|
72
|
+
stringLengthLabel = `length >= ${minLength}`;
|
|
73
|
+
} else if (hasMaxLength) {
|
|
74
|
+
stringLengthLabel = `length <= ${maxLength}`;
|
|
75
|
+
}
|
|
25
76
|
---
|
|
26
77
|
|
|
27
|
-
<div>
|
|
28
|
-
<div class="flex items-center gap-2">
|
|
29
|
-
<h5 class="font-
|
|
30
|
-
|
|
31
|
-
<>{i > 0 && <span class="inline">.</span>}<span class:list={["inline", a.length - 1 === i && "text-neutral-900 font-semibold"]}>{part}</span></>
|
|
32
|
-
))}
|
|
33
|
-
<!-- {name.split(".").map((part, i, a) => (
|
|
34
|
-
<>{i > 0 && <span class="inline">.</span>}<span class:list={["inline", a.length - 1 === i && "text-neutral-900 font-semibold"]}>{part}</span></>
|
|
35
|
-
))} -->
|
|
78
|
+
<div class="space-y-3">
|
|
79
|
+
<div class="flex flex-wrap items-center gap-x-2 gap-y-px">
|
|
80
|
+
<h5 class="font-medium leading-4">
|
|
81
|
+
{name}
|
|
36
82
|
</h5>
|
|
37
83
|
<code
|
|
38
|
-
class="text-[
|
|
84
|
+
class="text-[10px] font-medium text-neutral-500 border border-neutral-200/80 bg-neutral-50 px-1 rounded-sm"
|
|
39
85
|
>{type}</code
|
|
40
86
|
>
|
|
41
87
|
{
|
|
42
88
|
required && (
|
|
43
|
-
<div class="text-red-700/70 bg-red-50 border border-red-700/10 rounded-full px-
|
|
89
|
+
<div class="text-red-700/70 bg-red-50 border border-red-700/10 rounded-full px-1.5 text-[10px] font-mono leading-none py-0.5 pb-0.5 font-[450] h-fit">
|
|
44
90
|
required
|
|
45
91
|
</div>
|
|
46
92
|
)
|
|
47
93
|
}
|
|
48
94
|
{
|
|
49
95
|
optional && (
|
|
50
|
-
<div class="text-blue-700/70 bg-blue-50 border border-blue-700/10 rounded-full px-
|
|
96
|
+
<div class="text-blue-700/70 bg-blue-50 border border-blue-700/10 rounded-full px-1.5 font-mono text-[10px] leading-none py-0.5 pb-0.5 font-[450] h-fit">
|
|
51
97
|
optional
|
|
52
98
|
</div>
|
|
53
99
|
)
|
|
54
100
|
}
|
|
55
101
|
</div>
|
|
102
|
+
|
|
103
|
+
{
|
|
104
|
+
formattedDescription && (
|
|
105
|
+
<div
|
|
106
|
+
class="prose-rules prose-sm! leading-5! text-neutral-500 **:text-neutral-500"
|
|
107
|
+
set:html={formattedDescription}
|
|
108
|
+
/>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
56
111
|
{
|
|
57
112
|
enumValues && (
|
|
58
|
-
<div class="text-sm
|
|
59
|
-
<span class="font-medium
|
|
60
|
-
{enumValues.map((v, i, a) =>
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
113
|
+
<div class="text-sm flex flex-wrap items-center gap-x-1 gap-y-0.5">
|
|
114
|
+
<span class="font-medium text-xs">Options:</span>
|
|
115
|
+
{enumValues.map((v, i, a) => {
|
|
116
|
+
return (
|
|
117
|
+
<div class="flex">
|
|
118
|
+
<span class="text-[11px] font-medium text-neutral-600 border border-neutral-200 bg-neutral-50 px-1 py-px rounded-md">
|
|
119
|
+
<code>{v}</code>
|
|
120
|
+
</span>
|
|
121
|
+
{a.length - 2 === i ? (
|
|
122
|
+
<span class="ml-1"> or </span>
|
|
123
|
+
) : (
|
|
124
|
+
a.length - 1 !== i && <span>, </span>
|
|
125
|
+
)}
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
})}
|
|
129
|
+
</div>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
{
|
|
133
|
+
numericRangeLabel && (
|
|
134
|
+
<div class="text-sm">
|
|
135
|
+
<span class="font-medium text-xs">Range:</span>
|
|
136
|
+
<code class="text-[11px] font-medium text-neutral-600 border border-neutral-200 bg-neutral-50 px-1 py-px rounded-md">
|
|
137
|
+
{numericRangeLabel}
|
|
138
|
+
</code>
|
|
139
|
+
</div>
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
{
|
|
143
|
+
stringLengthLabel && (
|
|
144
|
+
<div class="text-sm">
|
|
145
|
+
<span class="font-medium text-xs">Length:</span>
|
|
146
|
+
<code class="text-[11px] font-medium text-neutral-600 border border-neutral-200 bg-neutral-50 px-1 py-px rounded-md">
|
|
147
|
+
{stringLengthLabel}
|
|
148
|
+
</code>
|
|
65
149
|
</div>
|
|
66
150
|
)
|
|
67
151
|
}
|
|
68
|
-
<div class="mt-1.5 prose-rules prose-sm!" set:html={formattedDescription} />
|
|
69
152
|
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Icon as AstroIcon } from "astro-icon/components";
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
name: string | undefined | null;
|
|
6
|
+
class?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { name, class: className, ...rest } = Astro.props;
|
|
11
|
+
|
|
12
|
+
if (!name) return null;
|
|
13
|
+
|
|
14
|
+
const isUrl = name.startsWith("http://") || name.startsWith("https://");
|
|
15
|
+
const isIconify = name.includes(":");
|
|
16
|
+
const isLocal = !isUrl && !isIconify;
|
|
17
|
+
|
|
18
|
+
// Normalize local path: if it doesn't start with /, add it
|
|
19
|
+
// Files from src/content/docs are copied to public root by copyContentAssets plugin
|
|
20
|
+
let src = name;
|
|
21
|
+
if (isLocal) {
|
|
22
|
+
src = name.startsWith("/") ? name : `/${name}`;
|
|
23
|
+
}
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
{
|
|
27
|
+
isUrl || isLocal ? (
|
|
28
|
+
<img src={src} class={className} {...rest} alt="" loading="lazy" />
|
|
29
|
+
) : (
|
|
30
|
+
<AstroIcon name={name} class={className} {...rest} />
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
class?: string;
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const { class: className, ...rest } = Astro.props;
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<svg
|
|
11
|
+
viewBox="0 0 24 24"
|
|
12
|
+
fill="none"
|
|
13
|
+
stroke="currentColor"
|
|
14
|
+
stroke-width="2"
|
|
15
|
+
stroke-linecap="round"
|
|
16
|
+
stroke-linejoin="round"
|
|
17
|
+
class={className}
|
|
18
|
+
{...rest}
|
|
19
|
+
>
|
|
20
|
+
<path d="M3 5h8M3 12h8M3 19h8"></path>
|
|
21
|
+
<polyline
|
|
22
|
+
points="15 8 18 5 21 8"
|
|
23
|
+
class="transition duration-200"
|
|
24
|
+
x-bind:style="expanded ? 'transform: rotate(180deg); transform-origin: 18px 6.5px;' : 'transform: rotate(0deg); transform-origin: 18px 6.5px;'"
|
|
25
|
+
></polyline>
|
|
26
|
+
<polyline
|
|
27
|
+
points="15 16 18 19 21 16"
|
|
28
|
+
class="transition duration-200"
|
|
29
|
+
x-bind:style="expanded ? 'transform: rotate(-180deg); transform-origin: 18px 17.5px;' : 'transform: rotate(0deg); transform-origin: 18px 17.5px;'"
|
|
30
|
+
></polyline>
|
|
31
|
+
</svg>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<span
|
|
2
|
-
class="text-[9px] bg-blue-100 text-blue-800 border border-blue-800/
|
|
2
|
+
class="text-[9px] bg-blue-100/70 text-blue-800/90 border border-blue-800/10 px-1.5 py-px rounded-full tracking-wide font-semibold shrink-0 normal-case"
|
|
3
3
|
>
|
|
4
4
|
<slot />
|
|
5
5
|
</span>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import
|
|
2
|
+
import Icon from "../ui/Icon.astro";
|
|
3
3
|
import { validateProps } from "../../lib/component-error";
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
@@ -20,7 +20,7 @@ validateProps(
|
|
|
20
20
|
defaultOpen: { type: "boolean" },
|
|
21
21
|
titleSize: { enum: ["xs", "sm", "md", "lg", "xl", "2xl"] },
|
|
22
22
|
},
|
|
23
|
-
Astro.url.pathname
|
|
23
|
+
Astro.url.pathname,
|
|
24
24
|
);
|
|
25
25
|
---
|
|
26
26
|
|
|
@@ -41,16 +41,16 @@ validateProps(
|
|
|
41
41
|
}`
|
|
42
42
|
x-init="id = (typeof register === 'function') ? register() : Math.random()"
|
|
43
43
|
role="region"
|
|
44
|
-
class="block border-b border-neutral-800/10
|
|
44
|
+
class="block border-b border-neutral-800/10 last:border-b-0 [&:first-child>h4>button]:pt-0 [&:last-child>div>div]:pb-0"
|
|
45
45
|
>
|
|
46
46
|
<h4 class="not-prose">
|
|
47
47
|
<button
|
|
48
48
|
type="button"
|
|
49
49
|
x-on:click="expanded = !expanded"
|
|
50
50
|
:aria-expanded="expanded"
|
|
51
|
-
class="group flex w-full items-center justify-between gap-2.5 text-left font-medium text-neutral-800"
|
|
51
|
+
class="pb-4 pt-4 group flex w-full items-center justify-between gap-2.5 text-left font-medium text-neutral-800"
|
|
52
52
|
>
|
|
53
|
-
{icon && <Icon name={
|
|
53
|
+
{icon && <Icon name={icon} />}
|
|
54
54
|
<span class:list={["flex-1", titleSize && `text-${titleSize}`]}
|
|
55
55
|
>{title}</span
|
|
56
56
|
>
|
|
@@ -62,7 +62,7 @@ validateProps(
|
|
|
62
62
|
</button>
|
|
63
63
|
</h4>
|
|
64
64
|
<div x-show="expanded" x-collapse>
|
|
65
|
-
<div class="
|
|
65
|
+
<div class="pb-4 *:first:mt-0 *:last:mb-0">
|
|
66
66
|
<slot />
|
|
67
67
|
</div>
|
|
68
68
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import
|
|
2
|
+
import Icon from "../ui/Icon.astro";
|
|
3
3
|
import warningIcon from "../../assets/icons/warning.svg?url";
|
|
4
4
|
import infoIcon from "../../assets/icons/info.svg?url";
|
|
5
5
|
import lightbulbIcon from "../../assets/icons/lightbulb.svg?url";
|
|
@@ -58,7 +58,7 @@ validateProps(
|
|
|
58
58
|
icon: { type: "string" },
|
|
59
59
|
color: { type: "string" },
|
|
60
60
|
},
|
|
61
|
-
Astro.url.pathname
|
|
61
|
+
Astro.url.pathname,
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
const defaults = typeDefaults[type];
|
|
@@ -79,14 +79,10 @@ const resolvedTitle = title ?? defaults.title;
|
|
|
79
79
|
style={color && { backgroundColor: color }}
|
|
80
80
|
>
|
|
81
81
|
</div>
|
|
82
|
-
<div class="flex items-center gap-2 not-prose">
|
|
82
|
+
<div class="flex items-center gap-2 not-prose mb-3">
|
|
83
83
|
{
|
|
84
84
|
icon ? (
|
|
85
|
-
<Icon
|
|
86
|
-
name={`lucide:${icon}`}
|
|
87
|
-
class=""
|
|
88
|
-
style={color && { color: color }}
|
|
89
|
-
/>
|
|
85
|
+
<Icon name={icon} class="size-4" style={color && { color: color }} />
|
|
90
86
|
) : (
|
|
91
87
|
<img src={defaults.icon} alt="" width="16" height="16" class="" />
|
|
92
88
|
)
|
|
@@ -95,7 +91,7 @@ const resolvedTitle = title ?? defaults.title;
|
|
|
95
91
|
{resolvedTitle}
|
|
96
92
|
</h6>
|
|
97
93
|
</div>
|
|
98
|
-
<div class="
|
|
94
|
+
<div class="**:first:mt-0! **:last:mb-0! text-sm">
|
|
99
95
|
<slot />
|
|
100
96
|
</div>
|
|
101
97
|
</aside>
|