radiant-docs 0.1.48 → 0.1.50
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/src/components/LogoLink.astro +2 -2
- package/template/src/components/SidebarGroup.astro +1 -1
- package/template/src/components/SidebarLink.astro +3 -3
- package/template/src/components/SidebarSubgroup.astro +1 -1
- package/template/src/components/endpoint/RequestSnippets.astro +30 -12
- package/template/src/components/endpoint/ResponseDisplay.astro +8 -9
- package/template/src/components/endpoint/ResponseSnippets.astro +27 -9
- package/template/src/components/sidebar/SidebarEndpointLink.astro +3 -2
- package/template/src/components/ui/Tag.astro +64 -2
- package/template/src/components/user/Accordion.astro +18 -4
- package/template/src/components/user/CodeBlock.astro +15 -5
- package/template/src/components/user/CodeGroup.astro +28 -11
- package/template/src/components/user/ComponentPreviewBlock.astro +32 -24
- package/template/src/components/user/Image.astro +119 -38
- package/template/src/components/user/Step.astro +2 -2
- package/template/src/components/user/Tabs.astro +59 -27
- package/template/src/lib/validation.ts +120 -8
- package/template/src/styles/global.css +3 -6
|
@@ -131,7 +131,7 @@ const INTERNAL_ONLY_COMPONENTS = new Set(["ComponentPreview"]);
|
|
|
131
131
|
export type NavPage = {
|
|
132
132
|
page: string;
|
|
133
133
|
icon?: string | null;
|
|
134
|
-
tag?:
|
|
134
|
+
tag?: NavTag;
|
|
135
135
|
title?: string;
|
|
136
136
|
};
|
|
137
137
|
export type NavOpenApiPageRef = {
|
|
@@ -141,14 +141,14 @@ export type NavOpenApiPageRef = {
|
|
|
141
141
|
export type NavOpenApiPage = {
|
|
142
142
|
openapi: NavOpenApiPageRef;
|
|
143
143
|
title?: string;
|
|
144
|
-
tag?:
|
|
144
|
+
tag?: NavTag;
|
|
145
145
|
};
|
|
146
146
|
export type NavGroup = {
|
|
147
147
|
group: string;
|
|
148
148
|
pages: (string | NavPage | NavGroup | NavOpenApiPage)[];
|
|
149
149
|
icon?: string | null;
|
|
150
150
|
expanded?: boolean; // need to add this logic
|
|
151
|
-
tag?:
|
|
151
|
+
tag?: NavTag;
|
|
152
152
|
};
|
|
153
153
|
export type NavOpenApi = {
|
|
154
154
|
source: string;
|
|
@@ -199,6 +199,16 @@ export type Logo = {
|
|
|
199
199
|
href?: string;
|
|
200
200
|
pill?: string | false;
|
|
201
201
|
};
|
|
202
|
+
export type ThemeColorByMode = {
|
|
203
|
+
light?: string;
|
|
204
|
+
dark?: string;
|
|
205
|
+
};
|
|
206
|
+
export type NavTag =
|
|
207
|
+
| string
|
|
208
|
+
| {
|
|
209
|
+
text: string;
|
|
210
|
+
color?: string | ThemeColorByMode;
|
|
211
|
+
};
|
|
202
212
|
export const BASE_COLOR_OPTIONS = [
|
|
203
213
|
"slate",
|
|
204
214
|
"gray",
|
|
@@ -217,10 +227,6 @@ export type BaseColorByMode = {
|
|
|
217
227
|
};
|
|
218
228
|
export const DEFAULT_THEME_COLOR_LIGHT = "#171717";
|
|
219
229
|
export const DEFAULT_THEME_COLOR_DARK = "#f5f5f5";
|
|
220
|
-
export type ThemeColorByMode = {
|
|
221
|
-
light?: string;
|
|
222
|
-
dark?: string;
|
|
223
|
-
};
|
|
224
230
|
export type CardCoverTheme = {
|
|
225
231
|
colors?: string[];
|
|
226
232
|
colorSeed?: string;
|
|
@@ -241,11 +247,15 @@ export type CodeSyntaxThemeConfig =
|
|
|
241
247
|
export type CodeTheme = {
|
|
242
248
|
syntaxTheme?: CodeSyntaxThemeConfig;
|
|
243
249
|
};
|
|
250
|
+
export type TagTheme = {
|
|
251
|
+
color?: string | ThemeColorByMode;
|
|
252
|
+
};
|
|
244
253
|
export type DocsTheme = {
|
|
245
254
|
baseColor?: BaseColorOption | BaseColorByMode;
|
|
246
255
|
themeColor?: string | ThemeColorByMode;
|
|
247
256
|
card?: CardTheme;
|
|
248
257
|
code?: CodeTheme;
|
|
258
|
+
tag?: TagTheme;
|
|
249
259
|
};
|
|
250
260
|
export type AssistantIcon = {
|
|
251
261
|
src?: string;
|
|
@@ -428,6 +438,71 @@ function normalizeThemeColorConfig(
|
|
|
428
438
|
};
|
|
429
439
|
}
|
|
430
440
|
|
|
441
|
+
function normalizeNavTagConfig(
|
|
442
|
+
value: unknown,
|
|
443
|
+
currentPath: Path,
|
|
444
|
+
label: string,
|
|
445
|
+
): NavTag | undefined {
|
|
446
|
+
if (value === undefined || value === null) return undefined;
|
|
447
|
+
|
|
448
|
+
if (typeof value === "string") {
|
|
449
|
+
const trimmedText = value.trim();
|
|
450
|
+
if (trimmedText.length === 0) {
|
|
451
|
+
throwConfigError(`${label} cannot be empty.`, currentPath);
|
|
452
|
+
}
|
|
453
|
+
return trimmedText;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
checkType(value, "object", currentPath, label);
|
|
457
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
458
|
+
throwConfigError(
|
|
459
|
+
`${label} must be a string or an object with text and optional color.`,
|
|
460
|
+
currentPath,
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
const tagConfig = value as Record<string, unknown>;
|
|
465
|
+
const allowedKeys = new Set(["text", "color"]);
|
|
466
|
+
for (const key of Object.keys(tagConfig)) {
|
|
467
|
+
if (!allowedKeys.has(key)) {
|
|
468
|
+
throwConfigError(`${label} object only supports 'text' and 'color'.`, [
|
|
469
|
+
...currentPath,
|
|
470
|
+
key,
|
|
471
|
+
]);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
checkType(tagConfig.text, "string", [...currentPath, "text"], `${label} text`);
|
|
476
|
+
if (typeof tagConfig.text !== "string") {
|
|
477
|
+
throwConfigError(`${label} text must be a string.`, [
|
|
478
|
+
...currentPath,
|
|
479
|
+
"text",
|
|
480
|
+
]);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const trimmedText = tagConfig.text.trim();
|
|
484
|
+
if (trimmedText.length === 0) {
|
|
485
|
+
throwConfigError(`${label} text cannot be empty.`, [
|
|
486
|
+
...currentPath,
|
|
487
|
+
"text",
|
|
488
|
+
]);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
const color =
|
|
492
|
+
tagConfig.color !== undefined
|
|
493
|
+
? normalizeThemeColorConfig(
|
|
494
|
+
tagConfig.color,
|
|
495
|
+
[...currentPath, "color"],
|
|
496
|
+
`${label} color`,
|
|
497
|
+
)
|
|
498
|
+
: undefined;
|
|
499
|
+
|
|
500
|
+
return {
|
|
501
|
+
text: trimmedText,
|
|
502
|
+
...(color !== undefined ? { color } : {}),
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
|
|
431
506
|
function normalizeHexColorArray(
|
|
432
507
|
value: unknown,
|
|
433
508
|
currentPath: Path,
|
|
@@ -909,6 +984,7 @@ async function validateNavigationNode(
|
|
|
909
984
|
checkType(item.expanded, "boolean", [...path, "expanded"], "Expanded");
|
|
910
985
|
|
|
911
986
|
validateIcon(item.icon, [...path, "icon"]);
|
|
987
|
+
item.tag = normalizeNavTagConfig(item.tag, [...path, "tag"], "Group tag");
|
|
912
988
|
|
|
913
989
|
// Check if pages array exists and validate children
|
|
914
990
|
if (!item.pages)
|
|
@@ -947,6 +1023,7 @@ async function validateNavigationNode(
|
|
|
947
1023
|
|
|
948
1024
|
// Validate optional title
|
|
949
1025
|
checkType(item.title, "string", [...path, "title"], "Page title");
|
|
1026
|
+
item.tag = normalizeNavTagConfig(item.tag, [...path, "tag"], "Page tag");
|
|
950
1027
|
|
|
951
1028
|
// Check D.2/D.3: Page cannot have group properties
|
|
952
1029
|
if ("expanded" in item)
|
|
@@ -971,7 +1048,11 @@ async function validateNavigationNode(
|
|
|
971
1048
|
|
|
972
1049
|
await validateNavOpenApiPage(item.openapi, [...path, "openapi"]);
|
|
973
1050
|
checkType(item.title, "string", [...path, "title"], "Open API page title");
|
|
974
|
-
|
|
1051
|
+
item.tag = normalizeNavTagConfig(
|
|
1052
|
+
item.tag,
|
|
1053
|
+
[...path, "tag"],
|
|
1054
|
+
"Open API page tag",
|
|
1055
|
+
);
|
|
975
1056
|
|
|
976
1057
|
if ("expanded" in item)
|
|
977
1058
|
throwConfigError("Open API page items cannot have 'expanded'.", [
|
|
@@ -1855,6 +1936,37 @@ function validateTheme(theme: DocsConfig["theme"]): void {
|
|
|
1855
1936
|
}
|
|
1856
1937
|
}
|
|
1857
1938
|
|
|
1939
|
+
if (theme.tag !== undefined) {
|
|
1940
|
+
checkType(theme.tag, "object", ["theme", "tag"], "Theme tag");
|
|
1941
|
+
if (
|
|
1942
|
+
typeof theme.tag !== "object" ||
|
|
1943
|
+
theme.tag === null ||
|
|
1944
|
+
Array.isArray(theme.tag)
|
|
1945
|
+
) {
|
|
1946
|
+
throwConfigError("Theme tag must be an object.", ["theme", "tag"]);
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
const tagTheme = theme.tag as TagTheme & Record<string, unknown>;
|
|
1950
|
+
const allowedTagKeys = new Set(["color"]);
|
|
1951
|
+
for (const key of Object.keys(tagTheme)) {
|
|
1952
|
+
if (!allowedTagKeys.has(key)) {
|
|
1953
|
+
throwConfigError("Theme tag configuration only supports 'color'.", [
|
|
1954
|
+
"theme",
|
|
1955
|
+
"tag",
|
|
1956
|
+
key,
|
|
1957
|
+
]);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
if (tagTheme.color !== undefined) {
|
|
1962
|
+
tagTheme.color = normalizeThemeColorConfig(
|
|
1963
|
+
tagTheme.color,
|
|
1964
|
+
["theme", "tag", "color"],
|
|
1965
|
+
"Theme tag color",
|
|
1966
|
+
);
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1858
1970
|
if (theme.card !== undefined) {
|
|
1859
1971
|
checkType(theme.card, "object", ["theme", "card"], "Theme card");
|
|
1860
1972
|
if (
|
|
@@ -55,12 +55,14 @@
|
|
|
55
55
|
--border-light: var(--color-neutral-100);
|
|
56
56
|
--input: oklch(0.922 0 0);
|
|
57
57
|
--ring: oklch(0.708 0 0);
|
|
58
|
+
--rd-panel-transition-duration-ms: 400;
|
|
59
|
+
--rd-panel-transition-duration: 400ms;
|
|
60
|
+
--rd-panel-transition-easing: cubic-bezier(0.22, 1, 0.36, 1);
|
|
58
61
|
--rd-code-surface: color-mix(
|
|
59
62
|
in srgb,
|
|
60
63
|
var(--color-neutral-100) 60%,
|
|
61
64
|
var(--background) 40%
|
|
62
65
|
);
|
|
63
|
-
--rd-code-header-surface: var(--color-white);
|
|
64
66
|
--rd-code-tab-edge-bg: var(--rd-code-surface);
|
|
65
67
|
--rd-code-tab-edge-border: color-mix(
|
|
66
68
|
in oklab,
|
|
@@ -94,11 +96,6 @@
|
|
|
94
96
|
var(--color-neutral-800) 55%,
|
|
95
97
|
var(--color-neutral-900) 45%
|
|
96
98
|
);
|
|
97
|
-
--rd-code-header-surface: color-mix(
|
|
98
|
-
in srgb,
|
|
99
|
-
var(--color-neutral-900) 100%,
|
|
100
|
-
var(--rd-code-surface) 0%
|
|
101
|
-
);
|
|
102
99
|
--rd-code-tab-edge-bg: var(--rd-code-surface);
|
|
103
100
|
--rd-code-tab-edge-border: color-mix(
|
|
104
101
|
in oklab,
|