zudoku 0.35.3 → 0.35.4
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/lib/components/Layout.js +1 -1
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/plugins/openapi/ParamInfos.d.ts +6 -0
- package/dist/lib/plugins/openapi/ParamInfos.js +34 -0
- package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -0
- package/dist/lib/plugins/openapi/ParameterListItem.js +5 -4
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +6 -8
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/dist/lib/ui/Button.d.ts +2 -2
- package/dist/lib/ui/Button.js +1 -0
- package/dist/lib/ui/Button.js.map +1 -1
- package/lib/{OasProvider-7Z9UwS9y.js → OasProvider-BbSqUQka.js} +2 -2
- package/lib/{OasProvider-7Z9UwS9y.js.map → OasProvider-BbSqUQka.js.map} +1 -1
- package/lib/{OperationList-a7wnHdXv.js → OperationList-CENzwqY8.js} +1063 -1029
- package/lib/OperationList-CENzwqY8.js.map +1 -0
- package/lib/{Spinner-1KrEmx1V.js → Spinner-C6n4eOvh.js} +13 -12
- package/lib/Spinner-C6n4eOvh.js.map +1 -0
- package/lib/{index-UmhI2mj7.js → index-BVhQWA89.js} +4 -4
- package/lib/{index-UmhI2mj7.js.map → index-BVhQWA89.js.map} +1 -1
- package/lib/ui/ActionButton.js +1 -1
- package/lib/ui/Button.js +12 -11
- package/lib/ui/Button.js.map +1 -1
- package/lib/zudoku.components.js +2 -2
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/package.json +1 -1
- package/src/lib/components/Layout.tsx +1 -1
- package/src/lib/plugins/openapi/ParamInfos.tsx +64 -0
- package/src/lib/plugins/openapi/ParameterListItem.tsx +9 -11
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +17 -33
- package/src/lib/ui/Button.tsx +3 -1
- package/lib/OperationList-a7wnHdXv.js.map +0 -1
- package/lib/Spinner-1KrEmx1V.js.map +0 -1
|
@@ -5,7 +5,7 @@ import "./chunk-HA7DTUK3-ZGg2W6yV.js";
|
|
|
5
5
|
import "./hook-CfCFKZ-2.js";
|
|
6
6
|
import "./ui/Button.js";
|
|
7
7
|
import "./joinUrl-10po2Jdj.js";
|
|
8
|
-
import { U as n, o as s } from "./index-
|
|
8
|
+
import { U as n, o as s } from "./index-BVhQWA89.js";
|
|
9
9
|
export {
|
|
10
10
|
n as UNTAGGED_PATH,
|
|
11
11
|
s as openApiPlugin
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ import { Slotlet } from "./SlotletProvider.js";
|
|
|
12
12
|
import { Spinner } from "./Spinner.js";
|
|
13
13
|
|
|
14
14
|
const LoadingFallback = () => (
|
|
15
|
-
<main className="col-span-full grid place-items-center">
|
|
15
|
+
<main className="col-span-full row-span-full grid place-items-center">
|
|
16
16
|
<Spinner />
|
|
17
17
|
</main>
|
|
18
18
|
);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { isValidElement } from "react";
|
|
2
|
+
import { InlineCode } from "../../components/InlineCode.js";
|
|
3
|
+
import { type SchemaObject } from "../../oas/parser/index.js";
|
|
4
|
+
|
|
5
|
+
const getSchemaInfos = (schema?: SchemaObject) => {
|
|
6
|
+
if (!schema) return [];
|
|
7
|
+
|
|
8
|
+
return [
|
|
9
|
+
schema.type === "array" && schema.items.type
|
|
10
|
+
? `${schema.items.type}[]`
|
|
11
|
+
: Array.isArray(schema.type)
|
|
12
|
+
? schema.type.join(" | ")
|
|
13
|
+
: schema.type,
|
|
14
|
+
|
|
15
|
+
schema.enum && "enum",
|
|
16
|
+
schema.format,
|
|
17
|
+
schema.minimum && `min: ${schema.minimum}`,
|
|
18
|
+
schema.maximum && `max: ${schema.maximum}`,
|
|
19
|
+
schema.minLength && `minLength: ${schema.minLength}`,
|
|
20
|
+
schema.maxLength && `maxLength: ${schema.maxLength}`,
|
|
21
|
+
schema.minItems && `minItems: ${schema.minItems}`,
|
|
22
|
+
schema.maxItems && `maxItems: ${schema.maxItems}`,
|
|
23
|
+
schema.uniqueItems && "unique",
|
|
24
|
+
schema.minProperties && `minProps: ${schema.minProperties}`,
|
|
25
|
+
schema.maxProperties && `maxProps: ${schema.maxProperties}`,
|
|
26
|
+
schema.readOnly && "readOnly",
|
|
27
|
+
schema.writeOnly && "writeOnly",
|
|
28
|
+
schema.deprecated && "deprecated",
|
|
29
|
+
schema.pattern && (
|
|
30
|
+
<>
|
|
31
|
+
pattern: <InlineCode className="text-xs">{schema.pattern}</InlineCode>
|
|
32
|
+
</>
|
|
33
|
+
),
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const ParamInfos = ({
|
|
38
|
+
schema,
|
|
39
|
+
extraItems = [],
|
|
40
|
+
className,
|
|
41
|
+
}: {
|
|
42
|
+
schema?: SchemaObject;
|
|
43
|
+
extraItems?: unknown[];
|
|
44
|
+
className?: string;
|
|
45
|
+
}) => {
|
|
46
|
+
const filteredItems = [...extraItems, ...getSchemaInfos(schema)].flatMap(
|
|
47
|
+
(item) => (typeof item === "string" || isValidElement(item) ? item : []),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className={className}>
|
|
52
|
+
{filteredItems.map((item, index) => (
|
|
53
|
+
<span className="text-muted-foreground" key={index}>
|
|
54
|
+
{item}
|
|
55
|
+
{index < filteredItems.length - 1 && (
|
|
56
|
+
<span className="text-muted-foreground/50">
|
|
57
|
+
·
|
|
58
|
+
</span>
|
|
59
|
+
)}
|
|
60
|
+
</span>
|
|
61
|
+
))}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Badge } from "zudoku/ui/Badge.js";
|
|
2
1
|
import { Markdown } from "../../components/Markdown.js";
|
|
3
2
|
import { type SchemaObject } from "../../oas/graphql/index.js";
|
|
4
3
|
import { ColorizedParam } from "./ColorizedParam.js";
|
|
5
4
|
import type { OperationListItemResult } from "./OperationList.js";
|
|
6
5
|
import type { ParameterGroup } from "./OperationListItem.js";
|
|
6
|
+
import { ParamInfos } from "./ParamInfos.js";
|
|
7
7
|
import { EnumValues } from "./components/EnumValues.js";
|
|
8
8
|
|
|
9
9
|
const getParameterSchema = (
|
|
@@ -40,22 +40,20 @@ export const ParameterListItem = ({
|
|
|
40
40
|
<ColorizedParam
|
|
41
41
|
name={parameter.name}
|
|
42
42
|
backgroundOpacity="15%"
|
|
43
|
-
className="px-
|
|
43
|
+
className="px-2"
|
|
44
44
|
slug={`${id}-${parameter.name}`}
|
|
45
45
|
/>
|
|
46
46
|
) : (
|
|
47
47
|
parameter.name
|
|
48
48
|
)}
|
|
49
49
|
</code>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{parameter.required && <Badge variant="outline">required</Badge>}
|
|
58
|
-
{parameter.style === "form" && <Badge variant="secondary">form</Badge>}
|
|
50
|
+
<ParamInfos
|
|
51
|
+
schema={paramSchema}
|
|
52
|
+
extraItems={[
|
|
53
|
+
parameter.required && "required",
|
|
54
|
+
parameter.style === "form" && "form",
|
|
55
|
+
]}
|
|
56
|
+
/>
|
|
59
57
|
</div>
|
|
60
58
|
{parameter.description && (
|
|
61
59
|
<Markdown
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
2
|
-
import {
|
|
2
|
+
import { MinusIcon, PlusIcon, RefreshCcwDotIcon } from "lucide-react";
|
|
3
3
|
import { useCallback, useState } from "react";
|
|
4
|
-
import { Badge } from "zudoku/ui/Badge.js";
|
|
5
4
|
import { Markdown, ProseClasses } from "../../../components/Markdown.js";
|
|
6
5
|
import type { SchemaObject } from "../../../oas/parser/index.js";
|
|
7
6
|
import { Button } from "../../../ui/Button.js";
|
|
8
7
|
import { cn } from "../../../util/cn.js";
|
|
9
8
|
import { objectEntries } from "../../../util/objectEntries.js";
|
|
10
9
|
import { EnumValues } from "../components/EnumValues.js";
|
|
10
|
+
import { ParamInfos } from "../ParamInfos.js";
|
|
11
11
|
import { LogicalGroup } from "./LogicalGroup/LogicalGroup.js";
|
|
12
12
|
import { SchemaView } from "./SchemaView.js";
|
|
13
13
|
import {
|
|
@@ -43,8 +43,8 @@ export const SchemaLogicalGroup = ({
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
const RecursiveIndicator = () => (
|
|
46
|
-
<div className="flex items-center gap-
|
|
47
|
-
<RefreshCcwDotIcon size={
|
|
46
|
+
<div className="flex items-center gap-1.5 italic text-xs text-muted-foreground font-mono bg-muted px-2 py-0.5 rounded-md">
|
|
47
|
+
<RefreshCcwDotIcon size={13} />
|
|
48
48
|
<span>circular</span>
|
|
49
49
|
</div>
|
|
50
50
|
);
|
|
@@ -69,11 +69,13 @@ export const SchemaPropertyItem = ({
|
|
|
69
69
|
if (isCircularRef(schema)) {
|
|
70
70
|
return (
|
|
71
71
|
<li className="p-4 bg-border/20 hover:bg-border/30">
|
|
72
|
-
<div className="flex flex-col gap-
|
|
72
|
+
<div className="flex flex-col gap-2.5 justify-between text-sm">
|
|
73
73
|
<div className="flex gap-2 items-center">
|
|
74
74
|
<code>{name}</code>
|
|
75
|
-
<
|
|
76
|
-
|
|
75
|
+
<ParamInfos
|
|
76
|
+
schema={schema}
|
|
77
|
+
extraItems={[group === "optional" && "optional"]}
|
|
78
|
+
/>
|
|
77
79
|
<RecursiveIndicator />
|
|
78
80
|
</div>
|
|
79
81
|
</div>
|
|
@@ -83,19 +85,13 @@ export const SchemaPropertyItem = ({
|
|
|
83
85
|
|
|
84
86
|
return (
|
|
85
87
|
<li className="p-4 bg-border/20 hover:bg-border/30">
|
|
86
|
-
<div className="flex flex-col gap-
|
|
88
|
+
<div className="flex flex-col gap-2.5 justify-between text-sm">
|
|
87
89
|
<div className="flex gap-2 items-center">
|
|
88
90
|
<code>{name}</code>
|
|
89
|
-
<
|
|
90
|
-
{schema
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<span>{schema.type.join(" | ")}</span>
|
|
94
|
-
) : (
|
|
95
|
-
<span>{schema.type}</span>
|
|
96
|
-
)}
|
|
97
|
-
</Badge>
|
|
98
|
-
{group === "optional" && <Badge variant="outline">optional</Badge>}
|
|
91
|
+
<ParamInfos
|
|
92
|
+
schema={schema}
|
|
93
|
+
extraItems={[group === "optional" && "optional"]}
|
|
94
|
+
/>
|
|
99
95
|
{schema.type === "array" &&
|
|
100
96
|
"items" in schema &&
|
|
101
97
|
isCircularRef(schema.items) && <RecursiveIndicator />}
|
|
@@ -106,12 +102,6 @@ export const SchemaPropertyItem = ({
|
|
|
106
102
|
content={schema.description}
|
|
107
103
|
/>
|
|
108
104
|
)}
|
|
109
|
-
{schema.format && (
|
|
110
|
-
<div>
|
|
111
|
-
<span className="text-sm text-muted-foreground">Format: </span>
|
|
112
|
-
<code>{schema.format}</code>
|
|
113
|
-
</div>
|
|
114
|
-
)}
|
|
115
105
|
{schema.enum && <EnumValues values={schema.enum} />}
|
|
116
106
|
|
|
117
107
|
{(hasLogicalGroupings(schema) || isComplexType(schema)) && (
|
|
@@ -122,15 +112,9 @@ export const SchemaPropertyItem = ({
|
|
|
122
112
|
>
|
|
123
113
|
{showCollapseButton && (
|
|
124
114
|
<Collapsible.Trigger asChild>
|
|
125
|
-
<Button
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
className="mt-2 flex gap-1.5"
|
|
129
|
-
>
|
|
130
|
-
<ListPlusIcon size={18} />
|
|
131
|
-
{!isOpen
|
|
132
|
-
? "Show nested properties"
|
|
133
|
-
: "Hide nested properties"}
|
|
115
|
+
<Button variant="expand" size="sm" className="h-7">
|
|
116
|
+
{isOpen ? <MinusIcon size={12} /> : <PlusIcon size={12} />}
|
|
117
|
+
{!isOpen ? "Show properties" : "Hide properties"}
|
|
134
118
|
</Button>
|
|
135
119
|
</Collapsible.Trigger>
|
|
136
120
|
)}
|
package/src/lib/ui/Button.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Slot } from "@radix-ui/react-slot";
|
|
2
|
-
import { cva, VariantProps } from "class-variance-authority";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "../util/cn.js";
|
|
5
5
|
|
|
@@ -18,6 +18,8 @@ export const buttonVariants = cva(
|
|
|
18
18
|
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
19
19
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
20
20
|
link: "text-primary underline-offset-4 hover:underline",
|
|
21
|
+
expand:
|
|
22
|
+
"flex gap-1.5 border bg-transparent rounded-xl text-muted-foreground hover:text-foreground",
|
|
21
23
|
},
|
|
22
24
|
size: {
|
|
23
25
|
default: "h-9 px-4 py-2",
|