zudoku 0.36.0 → 0.37.1
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/README.md +1 -1
- package/dist/config/validators/common.d.ts +252 -252
- package/dist/config/validators/common.js +4 -1
- package/dist/config/validators/common.js.map +1 -1
- package/dist/config/validators/validate.d.ts +95 -95
- package/dist/lib/components/InlineCode.d.ts +2 -1
- package/dist/lib/components/InlineCode.js +1 -1
- package/dist/lib/components/InlineCode.js.map +1 -1
- package/dist/lib/components/MobileTopNavigation.js +1 -1
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +2 -2
- package/dist/lib/components/TopNavigation.js +9 -12
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/Zudoku.js +3 -2
- package/dist/lib/components/Zudoku.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +1 -1
- package/dist/lib/components/context/ZudokuContext.js +9 -4
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/navigation/SidebarCategory.d.ts +2 -2
- package/dist/lib/components/navigation/SidebarCategory.js +10 -6
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
- package/dist/lib/components/navigation/SidebarItem.js +2 -2
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
- package/dist/lib/components/navigation/SidebarWrapper.js +1 -1
- package/dist/lib/components/navigation/SidebarWrapper.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +7 -5
- package/dist/lib/plugins/openapi/ParamInfos.js +12 -4
- package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +3 -3
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +13 -6
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/ui/Badge.d.ts +1 -1
- package/dist/lib/ui/Button.d.ts +1 -1
- package/dist/lib/ui/Button.js +1 -1
- package/dist/lib/ui/Button.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +6 -6
- package/dist/lib/util/joinPath.d.ts +3 -0
- package/dist/lib/util/joinPath.js +3 -0
- package/dist/lib/util/joinPath.js.map +1 -1
- package/dist/vite/api/schema-codegen.d.ts +1 -1
- package/dist/vite/api/schema-codegen.js +8 -4
- package/dist/vite/api/schema-codegen.js.map +1 -1
- package/dist/vite/config.js +1 -1
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugin-api.js +3 -3
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-docs.d.ts +1 -1
- package/dist/vite/plugin-docs.js +18 -1
- package/dist/vite/plugin-docs.js.map +1 -1
- package/lib/{AuthenticationPlugin-Cr6xjOJD.js → AuthenticationPlugin-Cij2tPWa.js} +2 -2
- package/lib/{AuthenticationPlugin-Cr6xjOJD.js.map → AuthenticationPlugin-Cij2tPWa.js.map} +1 -1
- package/lib/{Spinner-C6n4eOvh.js → Button-Fp19CMUr.js} +15 -18
- package/lib/Button-Fp19CMUr.js.map +1 -0
- package/lib/{Markdown-BlioIqkZ.js → Markdown-DT5Rrq8_.js} +3520 -3260
- package/lib/Markdown-DT5Rrq8_.js.map +1 -0
- package/lib/{MdxPage-7XnN9J9R.js → MdxPage-D2rD1vC4.js} +3 -3
- package/lib/{MdxPage-7XnN9J9R.js.map → MdxPage-D2rD1vC4.js.map} +1 -1
- package/lib/{OasProvider-BaRRMSsD.js → OasProvider-DdEBf2qS.js} +3 -3
- package/lib/{OasProvider-BaRRMSsD.js.map → OasProvider-DdEBf2qS.js.map} +1 -1
- package/lib/{OperationList-BjL1hzSx.js → OperationList-DT4-gm_S.js} +880 -878
- package/lib/OperationList-DT4-gm_S.js.map +1 -0
- package/lib/{Select-FAYHOYTy.js → Select-z1Lwl0-J.js} +3 -3
- package/lib/{Select-FAYHOYTy.js.map → Select-z1Lwl0-J.js.map} +1 -1
- package/lib/{SlotletProvider-CXb3wQiR.js → SlotletProvider-D8OBnr77.js} +2 -2
- package/lib/{SlotletProvider-CXb3wQiR.js.map → SlotletProvider-D8OBnr77.js.map} +1 -1
- package/lib/Spinner-CE68iCm0.js +7 -0
- package/lib/Spinner-CE68iCm0.js.map +1 -0
- package/lib/{hook-Bo80UX00.js → hook-DzQC8PzJ.js} +78 -74
- package/lib/hook-DzQC8PzJ.js.map +1 -0
- package/lib/{index-D5m8_oyY.js → index-DdQSV2RF.js} +31 -31
- package/lib/{index-D5m8_oyY.js.map → index-DdQSV2RF.js.map} +1 -1
- package/lib/{useQuery-CQUwWR9i.js → joinUrl-BjDooT-T.js} +240 -223
- package/lib/joinUrl-BjDooT-T.js.map +1 -0
- package/lib/{mutation-B81DztCT.js → mutation-_Z5C2wFZ.js} +2 -2
- package/lib/{mutation-B81DztCT.js.map → mutation-_Z5C2wFZ.js.map} +1 -1
- package/lib/ui/ActionButton.js +11 -10
- package/lib/ui/ActionButton.js.map +1 -1
- package/lib/ui/Button.js +1 -1
- package/lib/ui/Button.js.map +1 -1
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +3 -3
- package/lib/zudoku.components.js +345 -347
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +1 -1
- package/lib/zudoku.plugin-api-catalog.js +3 -3
- package/lib/zudoku.plugin-api-keys.js +4 -4
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +3 -3
- package/lib/zudoku.plugin-search-pagefind.js +15 -16
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/lib/zudoku.plugins.js.map +1 -1
- package/package.json +4 -2
- package/src/lib/components/InlineCode.tsx +3 -1
- package/src/lib/components/MobileTopNavigation.tsx +1 -1
- package/src/lib/components/TopNavigation.tsx +12 -16
- package/src/lib/components/Zudoku.tsx +5 -2
- package/src/lib/components/context/ZudokuContext.ts +12 -4
- package/src/lib/components/navigation/SidebarCategory.tsx +15 -12
- package/src/lib/components/navigation/SidebarItem.tsx +2 -2
- package/src/lib/components/navigation/SidebarWrapper.tsx +2 -2
- package/src/lib/core/plugins.ts +8 -8
- package/src/lib/plugins/openapi/ParamInfos.tsx +27 -4
- package/src/lib/plugins/openapi/ParameterListItem.tsx +5 -1
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +5 -2
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +48 -35
- package/src/lib/ui/Button.tsx +1 -1
- package/src/lib/util/joinPath.tsx +3 -0
- package/lib/Markdown-BlioIqkZ.js.map +0 -1
- package/lib/OperationList-BjL1hzSx.js.map +0 -1
- package/lib/Spinner-C6n4eOvh.js.map +0 -1
- package/lib/hook-Bo80UX00.js.map +0 -1
- package/lib/joinUrl-10po2Jdj.js +0 -20
- package/lib/joinUrl-10po2Jdj.js.map +0 -1
- package/lib/useQuery-CQUwWR9i.js.map +0 -1
|
@@ -1,6 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChevronsLeftRightIcon } from "lucide-react";
|
|
2
|
+
import { isValidElement, useState } from "react";
|
|
2
3
|
import { InlineCode } from "../../components/InlineCode.js";
|
|
3
4
|
import { type SchemaObject } from "../../oas/parser/index.js";
|
|
5
|
+
import { cn } from "../../util/cn.js";
|
|
6
|
+
|
|
7
|
+
const Pattern = ({ pattern }: { pattern: string }) => {
|
|
8
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
9
|
+
const isExpandable = pattern.length > 20;
|
|
10
|
+
const shortPattern = isExpandable ? `${pattern.slice(0, 20)}…` : pattern;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<InlineCode
|
|
14
|
+
className={cn("text-xs", isExpandable && "cursor-pointer")}
|
|
15
|
+
onClick={() => setIsExpanded(!isExpanded)}
|
|
16
|
+
selectOnClick={false}
|
|
17
|
+
>
|
|
18
|
+
{isExpanded ? pattern : shortPattern}
|
|
19
|
+
{isExpandable && (
|
|
20
|
+
<button type="button" className="p-1 translate-y-[2px]">
|
|
21
|
+
{!isExpanded && <ChevronsLeftRightIcon size={12} />}
|
|
22
|
+
</button>
|
|
23
|
+
)}
|
|
24
|
+
</InlineCode>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
4
27
|
|
|
5
28
|
const getSchemaInfos = (schema?: SchemaObject) => {
|
|
6
29
|
if (!schema) return [];
|
|
@@ -28,7 +51,7 @@ const getSchemaInfos = (schema?: SchemaObject) => {
|
|
|
28
51
|
schema.deprecated && "deprecated",
|
|
29
52
|
schema.pattern && (
|
|
30
53
|
<>
|
|
31
|
-
pattern: <
|
|
54
|
+
pattern: <Pattern pattern={schema.pattern} />
|
|
32
55
|
</>
|
|
33
56
|
),
|
|
34
57
|
];
|
|
@@ -48,7 +71,7 @@ export const ParamInfos = ({
|
|
|
48
71
|
);
|
|
49
72
|
|
|
50
73
|
return (
|
|
51
|
-
<
|
|
74
|
+
<span className={className}>
|
|
52
75
|
{filteredItems.map((item, index) => (
|
|
53
76
|
<span className="text-muted-foreground" key={index}>
|
|
54
77
|
{item}
|
|
@@ -59,6 +82,6 @@ export const ParamInfos = ({
|
|
|
59
82
|
)}
|
|
60
83
|
</span>
|
|
61
84
|
))}
|
|
62
|
-
</
|
|
85
|
+
</span>
|
|
63
86
|
);
|
|
64
87
|
};
|
|
@@ -67,7 +67,11 @@ export const ParameterListItem = ({
|
|
|
67
67
|
className="text-sm prose-p:my-1 prose-code:whitespace-pre-line"
|
|
68
68
|
/>
|
|
69
69
|
)}
|
|
70
|
-
{paramSchema.
|
|
70
|
+
{paramSchema.type === "array" && paramSchema.items.enum ? (
|
|
71
|
+
<EnumValues values={paramSchema.items.enum} />
|
|
72
|
+
) : (
|
|
73
|
+
paramSchema.enum && <EnumValues values={paramSchema.enum} />
|
|
74
|
+
)}
|
|
71
75
|
</li>
|
|
72
76
|
);
|
|
73
77
|
};
|
|
@@ -71,7 +71,7 @@ export const SchemaPropertyItem = ({
|
|
|
71
71
|
return (
|
|
72
72
|
<li className="p-4 bg-border/20 hover:bg-border/30">
|
|
73
73
|
<div className="flex flex-col gap-2.5 justify-between text-sm">
|
|
74
|
-
<div className="
|
|
74
|
+
<div className="space-x-2">
|
|
75
75
|
<code>{name}</code>
|
|
76
76
|
<ParamInfos schema={schema} />
|
|
77
77
|
<RecursiveIndicator />
|
|
@@ -84,7 +84,7 @@ export const SchemaPropertyItem = ({
|
|
|
84
84
|
return (
|
|
85
85
|
<li className="p-4 bg-border/20 hover:bg-border/30">
|
|
86
86
|
<div className="flex flex-col gap-2.5 justify-between text-sm">
|
|
87
|
-
<div className="
|
|
87
|
+
<div className="space-x-2">
|
|
88
88
|
<SelectOnClick asChild>
|
|
89
89
|
<code>{name}</code>
|
|
90
90
|
</SelectOnClick>
|
|
@@ -106,6 +106,9 @@ export const SchemaPropertyItem = ({
|
|
|
106
106
|
content={schema.description}
|
|
107
107
|
/>
|
|
108
108
|
)}
|
|
109
|
+
{schema.type === "array" && "items" in schema && schema.items.enum && (
|
|
110
|
+
<EnumValues values={schema.items.enum} />
|
|
111
|
+
)}
|
|
109
112
|
{schema.enum && <EnumValues values={schema.enum} />}
|
|
110
113
|
|
|
111
114
|
{(hasLogicalGroupings(schema) || isComplexType(schema)) && (
|
|
@@ -3,12 +3,22 @@ import type { SchemaObject } from "../../../oas/parser/index.js";
|
|
|
3
3
|
import { Card, CardContent, CardHeader, CardTitle } from "../../../ui/Card.js";
|
|
4
4
|
import { cn } from "../../../util/cn.js";
|
|
5
5
|
import { groupBy } from "../../../util/groupBy.js";
|
|
6
|
+
import { EnumValues } from "../components/EnumValues.js";
|
|
7
|
+
import { ParamInfos } from "../ParamInfos.js";
|
|
6
8
|
import {
|
|
7
9
|
SchemaLogicalGroup,
|
|
8
10
|
SchemaPropertyItem,
|
|
9
11
|
} from "./SchemaPropertyItem.js";
|
|
10
12
|
import { hasLogicalGroupings } from "./utils.js";
|
|
11
13
|
|
|
14
|
+
const renderMarkdown = (content?: string) =>
|
|
15
|
+
content && (
|
|
16
|
+
<Markdown
|
|
17
|
+
className={cn(ProseClasses, "text-sm leading-normal line-clamp-4")}
|
|
18
|
+
content={content}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
|
|
12
22
|
export const SchemaView = ({
|
|
13
23
|
schema,
|
|
14
24
|
level = 0,
|
|
@@ -33,11 +43,33 @@ export const SchemaView = ({
|
|
|
33
43
|
return <SchemaLogicalGroup schema={schema} level={level} />;
|
|
34
44
|
}
|
|
35
45
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
if (Array.isArray(schema.type)) {
|
|
47
|
+
return (
|
|
48
|
+
<Card className="p-4 space-y-2">
|
|
49
|
+
<span className="text-sm text-muted-foreground">
|
|
50
|
+
<ParamInfos schema={schema} />
|
|
51
|
+
</span>
|
|
52
|
+
{schema.enum && <EnumValues values={schema.enum} />}
|
|
53
|
+
{renderMarkdown(schema.description)}
|
|
54
|
+
</Card>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (schema.type === "array" && typeof schema.items === "object") {
|
|
39
59
|
const itemsSchema = schema.items as SchemaObject;
|
|
40
60
|
|
|
61
|
+
if (itemsSchema.enum) {
|
|
62
|
+
return (
|
|
63
|
+
<Card className="p-4">
|
|
64
|
+
<span className="text-sm text-muted-foreground">
|
|
65
|
+
<ParamInfos schema={schema} />
|
|
66
|
+
</span>
|
|
67
|
+
<EnumValues values={itemsSchema.enum} />
|
|
68
|
+
{renderMarkdown(schema.description)}
|
|
69
|
+
</Card>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
41
73
|
if (
|
|
42
74
|
typeof itemsSchema.type === "string" &&
|
|
43
75
|
["string", "number", "boolean", "integer"].includes(itemsSchema.type)
|
|
@@ -45,17 +77,9 @@ export const SchemaView = ({
|
|
|
45
77
|
return (
|
|
46
78
|
<Card className="p-4">
|
|
47
79
|
<span className="text-sm text-muted-foreground">
|
|
48
|
-
{
|
|
80
|
+
<ParamInfos schema={schema} />
|
|
49
81
|
</span>
|
|
50
|
-
{schema.description
|
|
51
|
-
<Markdown
|
|
52
|
-
className={cn(
|
|
53
|
-
ProseClasses,
|
|
54
|
-
"text-sm leading-normal line-clamp-4",
|
|
55
|
-
)}
|
|
56
|
-
content={schema.description}
|
|
57
|
-
/>
|
|
58
|
-
)}
|
|
82
|
+
{renderMarkdown(schema.description)}
|
|
59
83
|
</Card>
|
|
60
84
|
);
|
|
61
85
|
} else if (itemsSchema.type === "object") {
|
|
@@ -75,18 +99,12 @@ export const SchemaView = ({
|
|
|
75
99
|
(!schema.properties || Object.keys(schema.properties).length === 0)
|
|
76
100
|
) {
|
|
77
101
|
return (
|
|
78
|
-
<Card className="p-4 flex gap-2 items-
|
|
102
|
+
<Card className="p-4 flex gap-2 items-baseline">
|
|
79
103
|
{"name" in schema && <>{schema.name as string}</>}
|
|
80
|
-
<span className="text-sm text-muted-foreground">
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
ProseClasses,
|
|
85
|
-
"text-sm leading-normal line-clamp-4",
|
|
86
|
-
)}
|
|
87
|
-
content={schema.description}
|
|
88
|
-
/>
|
|
89
|
-
)}
|
|
104
|
+
<span className="text-sm text-muted-foreground">
|
|
105
|
+
<ParamInfos schema={schema} />
|
|
106
|
+
</span>
|
|
107
|
+
{renderMarkdown(schema.description)}
|
|
90
108
|
</Card>
|
|
91
109
|
);
|
|
92
110
|
}
|
|
@@ -133,17 +151,12 @@ export const SchemaView = ({
|
|
|
133
151
|
["string", "number", "boolean", "integer", "null"].includes(schema.type)
|
|
134
152
|
) {
|
|
135
153
|
return (
|
|
136
|
-
<Card className="p-4">
|
|
137
|
-
<span className="text-sm text-muted-foreground">
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
"text-sm leading-normal line-clamp-4",
|
|
143
|
-
)}
|
|
144
|
-
content={schema.description}
|
|
145
|
-
/>
|
|
146
|
-
)}
|
|
154
|
+
<Card className="p-4 space-y-2">
|
|
155
|
+
<span className="text-sm text-muted-foreground">
|
|
156
|
+
<ParamInfos schema={schema} />
|
|
157
|
+
</span>
|
|
158
|
+
{schema.enum && <EnumValues values={schema.enum} />}
|
|
159
|
+
{renderMarkdown(schema.description)}
|
|
147
160
|
</Card>
|
|
148
161
|
);
|
|
149
162
|
}
|
package/src/lib/ui/Button.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { cn } from "../util/cn.js";
|
|
5
5
|
|
|
6
6
|
export const buttonVariants = cva(
|
|
7
|
-
"not-prose inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
7
|
+
"not-prose inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|