zudoku 0.64.0 → 0.64.2
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/config/config.d.ts +15 -46
- package/dist/config/validators/InputNavigationSchema.d.ts +53 -53
- package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
- package/dist/config/validators/validate.d.ts +105 -1
- package/dist/config/validators/validate.js +30 -0
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +16 -0
- package/dist/lib/auth/issuer.js +3 -0
- package/dist/lib/auth/issuer.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +1 -1
- package/dist/lib/authentication/providers/firebase.d.ts +4 -0
- package/dist/lib/authentication/providers/firebase.js +215 -0
- package/dist/lib/authentication/providers/firebase.js.map +1 -0
- package/dist/lib/authentication/providers/supabase.js +1 -6
- package/dist/lib/authentication/providers/supabase.js.map +1 -1
- package/dist/lib/authentication/ui/ZudokuAuthUi.d.ts +24 -0
- package/dist/lib/authentication/ui/ZudokuAuthUi.js +124 -0
- package/dist/lib/authentication/ui/ZudokuAuthUi.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Apple.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Apple.js +4 -0
- package/dist/lib/authentication/ui/icons/Apple.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Facebook.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Facebook.js +4 -0
- package/dist/lib/authentication/ui/icons/Facebook.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Github.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Github.js +4 -0
- package/dist/lib/authentication/ui/icons/Github.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Google.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Google.js +4 -0
- package/dist/lib/authentication/ui/icons/Google.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Microsoft.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Microsoft.js +4 -0
- package/dist/lib/authentication/ui/icons/Microsoft.js.map +1 -0
- package/dist/lib/authentication/ui/icons/X.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/X.js +4 -0
- package/dist/lib/authentication/ui/icons/X.js.map +1 -0
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/core/RouteGuard.js +6 -6
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/oas/parser/index.js +7 -3
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/ProtectedRoute.js +4 -1
- package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.d.ts +1 -0
- package/dist/lib/plugins/openapi/CollapsibleCode.js +2 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.js.map +1 -1
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.d.ts +5 -0
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.js +10 -0
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.js.map +1 -0
- package/dist/lib/plugins/openapi/OperationList.js +4 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.d.ts +2 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +2 -2
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.d.ts +9 -2
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +2 -2
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.d.ts +3 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +14 -2
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.d.ts +2 -1
- package/dist/lib/plugins/openapi/Sidecar.js +33 -30
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SidecarExamples.d.ts +9 -2
- package/dist/lib/plugins/openapi/SidecarExamples.js +15 -33
- package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
- package/dist/lib/plugins/openapi/components/NonHighlightedCode.d.ts +4 -0
- package/dist/lib/plugins/openapi/components/NonHighlightedCode.js +5 -0
- package/dist/lib/plugins/openapi/components/NonHighlightedCode.js.map +1 -0
- package/dist/lib/plugins/openapi/components/ResponseContent.js +1 -1
- package/dist/lib/plugins/openapi/components/ResponseContent.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/InlineInput.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/ParamsGrid.d.ts +2 -2
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +1 -2
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +0 -4
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/union-helpers.js +0 -1
- package/dist/lib/plugins/openapi/schema/union-helpers.js.map +1 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js +9 -11
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -1
- package/dist/lib/ui/CodeBlock.d.ts +0 -1
- package/dist/lib/ui/CodeBlock.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +3 -3
- package/dist/lib/ui/EmbeddedCodeBlock.d.ts +0 -1
- package/dist/lib/ui/EmbeddedCodeBlock.js +1 -1
- package/dist/lib/ui/EmbeddedCodeBlock.js.map +1 -1
- package/dist/lib/ui/Separator.d.ts +4 -0
- package/dist/lib/ui/Separator.js +8 -0
- package/dist/lib/ui/Separator.js.map +1 -0
- package/dist/lib/ui/Tooltip.d.ts +7 -7
- package/dist/lib/ui/Tooltip.js +16 -10
- package/dist/lib/ui/Tooltip.js.map +1 -1
- package/dist/lib/util/createVariantComponent.d.ts +5 -2
- package/dist/lib/util/createVariantComponent.js +5 -2
- package/dist/lib/util/createVariantComponent.js.map +1 -1
- package/dist/lib/util/flattenAllOf.d.ts +4 -0
- package/dist/lib/util/flattenAllOf.js +65 -0
- package/dist/lib/util/flattenAllOf.js.map +1 -0
- package/dist/lib/util/flattenAllOf.test.d.ts +1 -0
- package/dist/lib/util/flattenAllOf.test.js +532 -0
- package/dist/lib/util/flattenAllOf.test.js.map +1 -0
- package/dist/vite/api/SchemaManager.js +6 -18
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/plugin-theme.js +10 -1
- package/dist/vite/plugin-theme.js.map +1 -1
- package/lib/{ErrorAlert-DE3Sf66a.js → ErrorAlert--3alJ_-b.js} +1340 -1311
- package/lib/{ErrorAlert-DE3Sf66a.js.map → ErrorAlert--3alJ_-b.js.map} +1 -1
- package/lib/{MdxPage-DZfeC0QY.js → MdxPage-Bpa9tL63.js} +5 -5
- package/lib/{MdxPage-DZfeC0QY.js.map → MdxPage-Bpa9tL63.js.map} +1 -1
- package/lib/{OAuthErrorPage-BycMozgn.js → OAuthErrorPage-B79J86Fo.js} +4 -4
- package/lib/{OAuthErrorPage-BycMozgn.js.map → OAuthErrorPage-B79J86Fo.js.map} +1 -1
- package/lib/{OasProvider-Bf5zBDBY.js → OasProvider-jr0oDSFy.js} +2 -2
- package/lib/{OasProvider-Bf5zBDBY.js.map → OasProvider-jr0oDSFy.js.map} +1 -1
- package/lib/OperationList-DLEAg4qw.js +5465 -0
- package/lib/OperationList-DLEAg4qw.js.map +1 -0
- package/lib/{Pagination-CJszmeSA.js → Pagination-H2HW9-Er.js} +2 -2
- package/lib/{Pagination-CJszmeSA.js.map → Pagination-H2HW9-Er.js.map} +1 -1
- package/lib/RouteGuard-CjzxosTf.js +77 -0
- package/lib/RouteGuard-CjzxosTf.js.map +1 -0
- package/lib/{RouterError-VDLnrFqF.js → RouterError-DZS2d6Sc.js} +2 -2
- package/lib/{RouterError-VDLnrFqF.js.map → RouterError-DZS2d6Sc.js.map} +1 -1
- package/lib/{SchemaList-xZSf3IMh.js → SchemaList-CSDSazqV.js} +6 -6
- package/lib/{SchemaList-xZSf3IMh.js.map → SchemaList-CSDSazqV.js.map} +1 -1
- package/lib/SchemaView-DJiBd0_5.js +397 -0
- package/lib/SchemaView-DJiBd0_5.js.map +1 -0
- package/lib/{SignUp-6SGx9Yyq.js → SignUp-Fycafbyg.js} +2 -2
- package/lib/{SignUp-6SGx9Yyq.js.map → SignUp-Fycafbyg.js.map} +1 -1
- package/lib/{SyntaxHighlight-zvlnSnHB.js → SyntaxHighlight-C19vH0V_.js} +525 -509
- package/lib/SyntaxHighlight-C19vH0V_.js.map +1 -0
- package/lib/{Toc-Da9yp7lo.js → Toc-ChkOg2UU.js} +2 -2
- package/lib/{Toc-Da9yp7lo.js.map → Toc-ChkOg2UU.js.map} +1 -1
- package/lib/{circular-DvuimBGQ.js → circular-DGfd8SGc.js} +2 -2
- package/lib/{circular-DvuimBGQ.js.map → circular-DGfd8SGc.js.map} +1 -1
- package/lib/{createServer-D9UvCoDf.js → createServer-DGD8hEzT.js} +4662 -4238
- package/lib/createServer-DGD8hEzT.js.map +1 -0
- package/lib/{errors-CuGgh3hf.js → errors-BTpjwHS6.js} +2 -2
- package/lib/{errors-CuGgh3hf.js.map → errors-BTpjwHS6.js.map} +1 -1
- package/lib/{index-rYHsvtTo.js → index-Bvas0H4x.js} +2 -2
- package/lib/{index-rYHsvtTo.js.map → index-Bvas0H4x.js.map} +1 -1
- package/lib/{index-Cr9_YzOZ.js → index-DP1xZgfJ.js} +9 -9
- package/lib/index-DP1xZgfJ.js.map +1 -0
- package/lib/{index-B1rmok4X.js → index-FNRZUtwo.js} +2 -2
- package/lib/{index-B1rmok4X.js.map → index-FNRZUtwo.js.map} +1 -1
- package/lib/ui/CodeBlock.js.map +1 -1
- package/lib/ui/EmbeddedCodeBlock.js +9 -9
- package/lib/ui/EmbeddedCodeBlock.js.map +1 -1
- package/lib/ui/Separator.js +27 -0
- package/lib/ui/Separator.js.map +1 -0
- package/lib/ui/SyntaxHighlight.js +1 -1
- package/lib/ui/Tooltip.js +55 -28
- package/lib/ui/Tooltip.js.map +1 -1
- package/lib/zudoku.__internal.js +4 -4
- package/lib/zudoku.auth-azureb2c.js +3 -3
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +3 -3
- package/lib/zudoku.auth-supabase.js +30 -33
- package/lib/zudoku.auth-supabase.js.map +1 -1
- package/lib/zudoku.components.js +2 -2
- package/lib/zudoku.plugin-api-catalog.js +3 -3
- package/lib/zudoku.plugin-api-keys.js +3 -3
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +1 -1
- package/package.json +16 -11
- package/src/app/main.css +1 -1
- package/src/lib/auth/issuer.ts +3 -0
- package/src/lib/authentication/authentication.ts +1 -1
- package/src/lib/authentication/providers/firebase.tsx +284 -0
- package/src/lib/authentication/providers/supabase.tsx +2 -7
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +335 -0
- package/src/lib/authentication/ui/icons/Apple.tsx +10 -0
- package/src/lib/authentication/ui/icons/Facebook.tsx +15 -0
- package/src/lib/authentication/ui/icons/Github.tsx +16 -0
- package/src/lib/authentication/ui/icons/Google.tsx +16 -0
- package/src/lib/authentication/ui/icons/Microsoft.tsx +12 -0
- package/src/lib/authentication/ui/icons/X.tsx +10 -0
- package/src/lib/core/RouteGuard.tsx +8 -8
- package/src/lib/oas/parser/index.ts +8 -3
- package/src/lib/plugins/api-keys/ProtectedRoute.tsx +11 -7
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +5 -3
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -0
- package/src/lib/plugins/openapi/OperationList.tsx +5 -0
- package/src/lib/plugins/openapi/OperationListItem.tsx +3 -0
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +20 -2
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +26 -1
- package/src/lib/plugins/openapi/Sidecar.tsx +84 -63
- package/src/lib/plugins/openapi/SidecarExamples.tsx +38 -48
- package/src/lib/plugins/openapi/components/NonHighlightedCode.tsx +22 -0
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +1 -1
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +1 -4
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +0 -5
- package/src/lib/plugins/openapi/schema/union-helpers.ts +0 -1
- package/src/lib/plugins/openapi/util/generateSchemaExample.ts +11 -11
- package/src/lib/ui/CodeBlock.tsx +0 -1
- package/src/lib/ui/EmbeddedCodeBlock.tsx +1 -2
- package/src/lib/ui/Separator.tsx +25 -0
- package/src/lib/ui/Tooltip.tsx +54 -32
- package/src/lib/util/createVariantComponent.tsx +31 -5
- package/src/lib/util/flattenAllOf.test.ts +637 -0
- package/src/lib/util/flattenAllOf.ts +101 -0
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.d.ts +0 -5
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.js +0 -7
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.js.map +0 -1
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.d.ts +0 -4
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.js +0 -10
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.js.map +0 -1
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.d.ts +0 -5
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.js +0 -16
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.js.map +0 -1
- package/lib/OperationList-Cmiw1xm2.js +0 -5446
- package/lib/OperationList-Cmiw1xm2.js.map +0 -1
- package/lib/RouteGuard-DhU3LRr1.js +0 -81
- package/lib/RouteGuard-DhU3LRr1.js.map +0 -1
- package/lib/SchemaView-tHXTm5oM.js +0 -458
- package/lib/SchemaView-tHXTm5oM.js.map +0 -1
- package/lib/SyntaxHighlight-zvlnSnHB.js.map +0 -1
- package/lib/createServer-D9UvCoDf.js.map +0 -1
- package/lib/index-Cr9_YzOZ.js.map +0 -1
- package/src/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.tsx +0 -36
- package/src/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.tsx +0 -25
- package/src/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.tsx +0 -42
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from "react";
|
|
2
|
-
import type { SchemaObject } from "../../oas/parser/index.js";
|
|
3
1
|
import { SyntaxHighlight } from "../../ui/SyntaxHighlight.js";
|
|
4
|
-
import {
|
|
2
|
+
import { NonHighlightedCode } from "./components/NonHighlightedCode.js";
|
|
5
3
|
import type { MediaTypeObject } from "./graphql/graphql.js";
|
|
6
4
|
import * as SidecarBox from "./SidecarBox.js";
|
|
7
5
|
import { SimpleSelect } from "./SimpleSelect.js";
|
|
8
|
-
import { generateSchemaExample } from "./util/generateSchemaExample.js";
|
|
9
6
|
|
|
10
7
|
const formatForDisplay = (value: unknown): string => {
|
|
11
8
|
if (value == null) return "No example";
|
|
@@ -35,47 +32,35 @@ const getLanguage = (mediaType?: string): string => {
|
|
|
35
32
|
export type SidecarExamplesProps = {
|
|
36
33
|
content: MediaTypeObject[];
|
|
37
34
|
description?: string;
|
|
38
|
-
|
|
35
|
+
selectedContentIndex: number;
|
|
36
|
+
selectedExampleIndex: number;
|
|
37
|
+
onExampleChange?: ({
|
|
38
|
+
contentTypeIndex,
|
|
39
|
+
exampleIndex,
|
|
40
|
+
}: {
|
|
41
|
+
contentTypeIndex: number;
|
|
42
|
+
exampleIndex: number;
|
|
43
|
+
}) => void;
|
|
44
|
+
isOnScreen: boolean;
|
|
45
|
+
shouldLazyHighlight?: boolean;
|
|
39
46
|
};
|
|
40
47
|
|
|
41
48
|
export const SidecarExamples = ({
|
|
42
49
|
content,
|
|
43
50
|
description,
|
|
44
51
|
onExampleChange,
|
|
52
|
+
selectedContentIndex,
|
|
53
|
+
selectedExampleIndex,
|
|
54
|
+
isOnScreen,
|
|
55
|
+
shouldLazyHighlight,
|
|
45
56
|
}: SidecarExamplesProps) => {
|
|
46
|
-
const [selectedContentTypeIndex, setSelectedContentTypeIndex] = useState(0);
|
|
47
|
-
const [selectedExampleIndex, setSelectedExampleIndex] = useState(0);
|
|
48
|
-
|
|
49
|
-
// Get the effective content (handle single item array case)
|
|
50
|
-
const effectiveContent =
|
|
51
|
-
Array.isArray(content) && content.length === 1
|
|
52
|
-
? content[0]
|
|
53
|
-
: content[selectedContentTypeIndex];
|
|
54
|
-
|
|
55
57
|
// Get example value, with fallback to schema-generated example
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const exampleValue = useMemo(() => {
|
|
60
|
-
if (selectedExample) {
|
|
61
|
-
// If it's a wrapped example with a value field, use that
|
|
62
|
-
return "value" in selectedExample
|
|
63
|
-
? selectedExample.value
|
|
64
|
-
: selectedExample;
|
|
65
|
-
} else if (effectiveContent?.schema) {
|
|
66
|
-
// No example provided, generate one from schema
|
|
67
|
-
return generateSchemaExample(effectiveContent.schema as SchemaObject);
|
|
68
|
-
}
|
|
69
|
-
}, [selectedExample, effectiveContent?.schema]);
|
|
70
|
-
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
if (!exampleValue) return;
|
|
73
|
-
|
|
74
|
-
onExampleChange?.(exampleValue);
|
|
75
|
-
}, [exampleValue, onExampleChange]);
|
|
58
|
+
const selectedContent = content[selectedContentIndex];
|
|
59
|
+
const examples = selectedContent?.examples ?? [];
|
|
60
|
+
const selectedExample = examples?.[selectedExampleIndex];
|
|
76
61
|
|
|
77
|
-
const formattedExample = formatForDisplay(
|
|
78
|
-
const language = getLanguage(
|
|
62
|
+
const formattedExample = formatForDisplay(selectedExample?.value);
|
|
63
|
+
const language = getLanguage(selectedContent?.mediaType);
|
|
79
64
|
|
|
80
65
|
return (
|
|
81
66
|
<>
|
|
@@ -91,16 +76,15 @@ export const SidecarExamples = ({
|
|
|
91
76
|
View External Example →
|
|
92
77
|
</a>
|
|
93
78
|
</div>
|
|
79
|
+
) : shouldLazyHighlight && !isOnScreen ? (
|
|
80
|
+
<NonHighlightedCode code={formattedExample} />
|
|
94
81
|
) : (
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
code={formattedExample}
|
|
102
|
-
/>
|
|
103
|
-
</CollapsibleCode>
|
|
82
|
+
<SyntaxHighlight
|
|
83
|
+
embedded
|
|
84
|
+
language={language}
|
|
85
|
+
className="[--scrollbar-color:gray] rounded-none max-h-[200px] text-xs overflow-auto"
|
|
86
|
+
code={formattedExample}
|
|
87
|
+
/>
|
|
104
88
|
)}
|
|
105
89
|
{selectedExample?.description && (
|
|
106
90
|
<div className="border-t text-xs px-3 py-1.5 text-muted-foreground">
|
|
@@ -120,9 +104,12 @@ export const SidecarExamples = ({
|
|
|
120
104
|
{content.length > 1 ? (
|
|
121
105
|
<SimpleSelect
|
|
122
106
|
className="max-w-[200px]"
|
|
123
|
-
value={
|
|
107
|
+
value={selectedContentIndex.toString()}
|
|
124
108
|
onChange={(e) =>
|
|
125
|
-
|
|
109
|
+
onExampleChange?.({
|
|
110
|
+
contentTypeIndex: Number(e.target.value),
|
|
111
|
+
exampleIndex: 0,
|
|
112
|
+
})
|
|
126
113
|
}
|
|
127
114
|
options={content.map((c, index) => ({
|
|
128
115
|
value: index.toString(),
|
|
@@ -141,7 +128,10 @@ export const SidecarExamples = ({
|
|
|
141
128
|
className="max-w-[180px]"
|
|
142
129
|
value={selectedExampleIndex.toString()}
|
|
143
130
|
onChange={(e) =>
|
|
144
|
-
|
|
131
|
+
onExampleChange?.({
|
|
132
|
+
contentTypeIndex: selectedContentIndex,
|
|
133
|
+
exampleIndex: Number(e.target.value),
|
|
134
|
+
})
|
|
145
135
|
}
|
|
146
136
|
options={examples.map((example, index) => ({
|
|
147
137
|
value: index.toString(),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cn } from "../../../util/cn.js";
|
|
2
|
+
import { OverflowOverlay } from "../CollapsibleCode.js";
|
|
3
|
+
|
|
4
|
+
export const NonHighlightedCode = ({
|
|
5
|
+
code,
|
|
6
|
+
className,
|
|
7
|
+
}: {
|
|
8
|
+
code: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}) => (
|
|
11
|
+
<pre
|
|
12
|
+
className={cn(
|
|
13
|
+
"relative text-(--shiki-light) dark:text-(--shiki-dark) p-2 text-xs font-mono max-h-[250px] leading-4.5 bg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg) overflow-hidden",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
>
|
|
17
|
+
<code>
|
|
18
|
+
{code.split("\n").length > 13 && <OverflowOverlay />}
|
|
19
|
+
{code}
|
|
20
|
+
</code>
|
|
21
|
+
</pre>
|
|
22
|
+
);
|
|
@@ -71,7 +71,7 @@ export const ResponseContent = ({
|
|
|
71
71
|
</div>
|
|
72
72
|
{currentResponse?.description && (
|
|
73
73
|
<Markdown
|
|
74
|
-
className="text-sm border-t px-4 py-2 text-muted-foreground"
|
|
74
|
+
className="text-sm border-t px-4 py-2 text-muted-foreground max-w-none"
|
|
75
75
|
content={currentResponse.description}
|
|
76
76
|
/>
|
|
77
77
|
)}
|
|
@@ -9,7 +9,6 @@ import { ConstValue } from "../components/ConstValue.js";
|
|
|
9
9
|
import { EnumValues } from "../components/EnumValues.js";
|
|
10
10
|
import { SelectOnClick } from "../components/SelectOnClick.js";
|
|
11
11
|
import { ParamInfos } from "../ParamInfos.js";
|
|
12
|
-
import { AllOfGroupView } from "./AllOfGroup/AllOfGroupView.js";
|
|
13
12
|
import { SchemaExampleAndDefault } from "./SchemaExampleAndDefault.js";
|
|
14
13
|
import { SchemaView } from "./SchemaView.js";
|
|
15
14
|
import {
|
|
@@ -124,9 +123,7 @@ export const SchemaPropertyItem = ({
|
|
|
124
123
|
)}
|
|
125
124
|
<Collapsible.Content>
|
|
126
125
|
<div className="mt-2">
|
|
127
|
-
{schema.
|
|
128
|
-
<AllOfGroupView schema={schema} />
|
|
129
|
-
) : schema.anyOf || schema.oneOf || schema.type === "object" ? (
|
|
126
|
+
{schema.anyOf || schema.oneOf || schema.type === "object" ? (
|
|
130
127
|
<SchemaView schema={schema} />
|
|
131
128
|
) : isArrayType(schema) && "items" in schema ? (
|
|
132
129
|
<SchemaView schema={schema.items} />
|
|
@@ -6,7 +6,6 @@ import { groupBy } from "../../../util/groupBy.js";
|
|
|
6
6
|
import { ConstValue } from "../components/ConstValue.js";
|
|
7
7
|
import { EnumValues } from "../components/EnumValues.js";
|
|
8
8
|
import { ParamInfos } from "../ParamInfos.js";
|
|
9
|
-
import { AllOfGroupView } from "./AllOfGroup/AllOfGroupView.js";
|
|
10
9
|
import { SchemaExampleAndDefault } from "./SchemaExampleAndDefault.js";
|
|
11
10
|
import { SchemaPropertyItem } from "./SchemaPropertyItem.js";
|
|
12
11
|
import { UnionView } from "./UnionView.js";
|
|
@@ -67,10 +66,6 @@ export const SchemaView = ({
|
|
|
67
66
|
return <UnionView schema={schema} cardHeader={cardHeader} />;
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
if (Array.isArray(schema.allOf)) {
|
|
71
|
-
return <AllOfGroupView schema={schema} cardHeader={cardHeader} />;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
69
|
if (isBasicType(schema.type)) {
|
|
75
70
|
return renderBasicSchema(schema, cardHeader);
|
|
76
71
|
}
|
|
@@ -85,23 +85,23 @@ export const generateSchemaExample = (
|
|
|
85
85
|
return schema.enum[0];
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
if (schema.oneOf) {
|
|
89
|
-
|
|
90
|
-
return generateSchemaExample(schema.oneOf[randomIndex] as SchemaObject);
|
|
88
|
+
if (schema.oneOf && schema.oneOf.length > 0) {
|
|
89
|
+
return generateSchemaExample(schema.oneOf[0]);
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
if (schema.anyOf) {
|
|
92
|
+
if (schema.anyOf && schema.anyOf.length > 0) {
|
|
94
93
|
// Should likely be expanded to return a partial set of values, but it would require
|
|
95
94
|
// detection if being used within an array or a string type.
|
|
96
|
-
|
|
97
|
-
return generateSchemaExample(schema.anyOf[randomIndex] as SchemaObject);
|
|
95
|
+
return generateSchemaExample(schema.anyOf[0]);
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
// Check for property-level examples
|
|
99
|
+
if (
|
|
100
|
+
schema.examples &&
|
|
101
|
+
Array.isArray(schema.examples) &&
|
|
102
|
+
schema.examples.length > 0
|
|
103
|
+
) {
|
|
104
|
+
return schema.examples[0];
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
switch (schema.type) {
|
package/src/lib/ui/CodeBlock.tsx
CHANGED
|
@@ -5,7 +5,6 @@ import { cn } from "../util/cn.js";
|
|
|
5
5
|
|
|
6
6
|
export type CodeBlockProps = {
|
|
7
7
|
className?: string;
|
|
8
|
-
noBackground?: boolean;
|
|
9
8
|
wrapLines?: boolean;
|
|
10
9
|
showLanguageIndicator?: boolean;
|
|
11
10
|
language?: string;
|
|
@@ -42,7 +41,7 @@ export const EmbeddedCodeBlock = ({
|
|
|
42
41
|
>
|
|
43
42
|
<div
|
|
44
43
|
className={cn(
|
|
45
|
-
"code-block text-sm not-prose scrollbar [&>pre]:overflow-x-auto [
|
|
44
|
+
"code-block text-sm not-prose scrollbar [&>pre]:overflow-x-auto [&_code]:p-2",
|
|
46
45
|
fullHeight && "h-full [&>pre]:h-full",
|
|
47
46
|
props.className,
|
|
48
47
|
)}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
import { cn } from "../util/cn.js";
|
|
4
|
+
|
|
5
|
+
function Separator({
|
|
6
|
+
className,
|
|
7
|
+
orientation = "horizontal",
|
|
8
|
+
decorative = true,
|
|
9
|
+
...props
|
|
10
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
11
|
+
return (
|
|
12
|
+
<SeparatorPrimitive.Root
|
|
13
|
+
data-slot="separator"
|
|
14
|
+
decorative={decorative}
|
|
15
|
+
orientation={orientation}
|
|
16
|
+
className={cn(
|
|
17
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
18
|
+
className,
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Separator };
|
package/src/lib/ui/Tooltip.tsx
CHANGED
|
@@ -1,43 +1,65 @@
|
|
|
1
1
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
2
|
-
import
|
|
2
|
+
import { TooltipArrow } from "@radix-ui/react-tooltip";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
import { cn } from "./util.js";
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
function TooltipProvider({
|
|
7
|
+
delayDuration = 0,
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
10
|
+
return (
|
|
11
|
+
<TooltipPrimitive.Provider
|
|
12
|
+
data-slot="tooltip-provider"
|
|
13
|
+
delayDuration={delayDuration}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
5
18
|
|
|
6
|
-
|
|
19
|
+
function Tooltip({
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
22
|
+
return (
|
|
23
|
+
<TooltipProvider>
|
|
24
|
+
<TooltipPrimitive.Root data-slot="tooltip" {...props} />
|
|
25
|
+
</TooltipProvider>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
7
28
|
|
|
8
|
-
|
|
29
|
+
function TooltipTrigger({
|
|
30
|
+
...props
|
|
31
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
32
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
33
|
+
}
|
|
9
34
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/>
|
|
34
|
-
));
|
|
35
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
35
|
+
function TooltipContent({
|
|
36
|
+
className,
|
|
37
|
+
sideOffset = 0,
|
|
38
|
+
children,
|
|
39
|
+
...props
|
|
40
|
+
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
41
|
+
return (
|
|
42
|
+
<TooltipPrimitive.Portal>
|
|
43
|
+
<TooltipPrimitive.Content
|
|
44
|
+
data-slot="tooltip-content"
|
|
45
|
+
sideOffset={sideOffset}
|
|
46
|
+
className={cn(
|
|
47
|
+
"bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
48
|
+
className,
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
<TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]" />
|
|
54
|
+
</TooltipPrimitive.Content>
|
|
55
|
+
</TooltipPrimitive.Portal>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
36
58
|
|
|
37
59
|
export {
|
|
38
60
|
Tooltip,
|
|
39
|
-
|
|
61
|
+
TooltipTrigger,
|
|
40
62
|
TooltipContent,
|
|
41
63
|
TooltipProvider,
|
|
42
|
-
|
|
64
|
+
TooltipArrow,
|
|
43
65
|
};
|
|
@@ -5,8 +5,31 @@ import type { HTMLElementType, JSX } from "react";
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { cn } from "./cn.js";
|
|
7
7
|
|
|
8
|
+
type ComponentOrElement =
|
|
9
|
+
| HTMLElementType
|
|
10
|
+
// biome-ignore lint/suspicious/noExplicitAny: Need to accept any component type
|
|
11
|
+
| React.ComponentType<any>
|
|
12
|
+
// biome-ignore lint/suspicious/noExplicitAny: Need to accept any component type
|
|
13
|
+
| React.ForwardRefExoticComponent<any>;
|
|
14
|
+
|
|
15
|
+
type PropsOf<T> = T extends HTMLElementType
|
|
16
|
+
? JSX.IntrinsicElements[T]
|
|
17
|
+
: T extends React.ComponentType<infer P>
|
|
18
|
+
? P
|
|
19
|
+
: T extends React.ForwardRefExoticComponent<infer P>
|
|
20
|
+
? P
|
|
21
|
+
: never;
|
|
22
|
+
|
|
23
|
+
type RefOf<T> = T extends HTMLElementType
|
|
24
|
+
? T extends keyof HTMLElementTagNameMap
|
|
25
|
+
? HTMLElementTagNameMap[T]
|
|
26
|
+
: HTMLElement
|
|
27
|
+
: T extends React.ForwardRefExoticComponent<React.RefAttributes<infer R>>
|
|
28
|
+
? R
|
|
29
|
+
: HTMLElement;
|
|
30
|
+
|
|
8
31
|
const createVariantComponent = <
|
|
9
|
-
E extends
|
|
32
|
+
E extends ComponentOrElement,
|
|
10
33
|
C extends ReturnType<typeof cva>,
|
|
11
34
|
>(
|
|
12
35
|
tag: E,
|
|
@@ -14,20 +37,23 @@ const createVariantComponent = <
|
|
|
14
37
|
// variantProps: Array<keyof VariantProps<C>> = [],
|
|
15
38
|
) => {
|
|
16
39
|
const MyVariant = React.forwardRef<
|
|
17
|
-
|
|
18
|
-
|
|
40
|
+
RefOf<E>,
|
|
41
|
+
PropsOf<E> & { className?: ClassValue; asChild?: boolean }
|
|
19
42
|
>(({ className, asChild, ...props }, ref) => {
|
|
20
43
|
const Comp = asChild ? Slot : tag;
|
|
21
44
|
|
|
22
45
|
return React.createElement(Comp, {
|
|
23
46
|
...props,
|
|
24
|
-
ref
|
|
47
|
+
ref: ref as React.Ref<HTMLElement>,
|
|
25
48
|
className:
|
|
26
49
|
typeof cvx === "function" ? cvx({ className }) : cn(cvx, className),
|
|
27
50
|
});
|
|
28
51
|
});
|
|
29
52
|
|
|
30
|
-
MyVariant.displayName =
|
|
53
|
+
MyVariant.displayName =
|
|
54
|
+
typeof tag === "string"
|
|
55
|
+
? `VariantComponent(${tag})`
|
|
56
|
+
: `VariantComponent(${tag.displayName || tag.name || "Component"})`;
|
|
31
57
|
|
|
32
58
|
return MyVariant;
|
|
33
59
|
};
|