zudoku 0.3.1-dev.5 → 0.3.1-dev.7
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/plugins/openapi/OperationListItem.js +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.d.ts +9 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js +14 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.d.ts +6 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js +17 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.d.ts +7 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js +10 -0
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/SchemaComponents.d.ts +3 -3
- package/dist/lib/plugins/openapi/schema/SchemaComponents.js +15 -15
- package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/utils.d.ts +6 -0
- package/dist/lib/plugins/openapi/schema/utils.js +5 -0
- package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
- package/lib/{Input-DB9VROFR.js → Input-CzXNm7xb.js} +2 -1
- package/lib/{Input-DB9VROFR.js.map → Input-CzXNm7xb.js.map} +1 -1
- package/lib/OperationList-CJajXSzC.js +595 -0
- package/lib/OperationList-CJajXSzC.js.map +1 -0
- package/lib/{Route-DfAFiR7v.js → Route-BpMrPUVN.js} +2 -2
- package/lib/{Route-DfAFiR7v.js.map → Route-BpMrPUVN.js.map} +1 -1
- package/lib/{index-D-9zqIOh.js → index-B6zugCnN.js} +4 -4
- package/lib/{index-D-9zqIOh.js.map → index-B6zugCnN.js.map} +1 -1
- package/lib/zudoku.plugin-api-keys.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/package.json +1 -1
- package/src/app/main.css +25 -0
- package/src/lib/plugins/openapi/OperationListItem.tsx +1 -1
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.tsx +47 -0
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.tsx +54 -0
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.tsx +30 -0
- package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +41 -41
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +4 -4
- package/src/lib/plugins/openapi/schema/utils.ts +8 -0
- package/lib/OperationList-Cxiw2Z-v.js +0 -457
- package/lib/OperationList-Cxiw2Z-v.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-B6kdoens.js";
|
|
2
2
|
import { S as p, R as f } from "./SlotletProvider-ByLSCZQa.js";
|
|
3
|
-
import { u as g, a as u, I as j, S as k, b as v, c as w, d as b, e as K, f as y } from "./Input-
|
|
3
|
+
import { u as g, a as u, I as j, S as k, b as v, c as w, d as b, e as K, f as y } from "./Input-CzXNm7xb.js";
|
|
4
4
|
import { b as N, L as x, O as E } from "./index-7kcHaXD6.js";
|
|
5
5
|
import { u as h, t as A, j as S } from "./ZudokuContext-BIZ8zHbZ.js";
|
|
6
6
|
import { B as l, p as I } from "./Combination-DTfV-c98.js";
|
package/package.json
CHANGED
package/src/app/main.css
CHANGED
|
@@ -192,6 +192,31 @@
|
|
|
192
192
|
background: transparent;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
.wavy-line {
|
|
196
|
+
@apply bg-primary w-full;
|
|
197
|
+
|
|
198
|
+
--s: 3px; /* size of the wave */
|
|
199
|
+
--b: 2px; /* thickness of the line */
|
|
200
|
+
--m: 1; /* curvature of the wave [0 2] */
|
|
201
|
+
|
|
202
|
+
--R: calc(var(--s) * sqrt(var(--m) * var(--m) + 1) + var(--b) / 2);
|
|
203
|
+
height: calc(2 * var(--R));
|
|
204
|
+
--_g: #0000 calc(99% - var(--b)), #000 calc(101% - var(--b)) 99%, #0000 101%;
|
|
205
|
+
mask:
|
|
206
|
+
radial-gradient(
|
|
207
|
+
var(--R) at left 50% bottom calc(-1 * var(--m) * var(--s)),
|
|
208
|
+
var(--_g)
|
|
209
|
+
)
|
|
210
|
+
calc(50% - 2 * var(--s)) calc(50% - var(--s) / 2 - var(--b) / 2) /
|
|
211
|
+
calc(4 * var(--s)) calc(var(--s) + var(--b)) repeat-x,
|
|
212
|
+
radial-gradient(
|
|
213
|
+
var(--R) at left 50% top calc(-1 * var(--m) * var(--s)),
|
|
214
|
+
var(--_g)
|
|
215
|
+
)
|
|
216
|
+
50% calc(50% + var(--s) / 2 + var(--b) / 2) / calc(4 * var(--s))
|
|
217
|
+
calc(var(--s) + var(--b)) repeat-x;
|
|
218
|
+
}
|
|
219
|
+
|
|
195
220
|
/* Theme */
|
|
196
221
|
:root {
|
|
197
222
|
--background: 0 0% 100%;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
2
|
+
import { SquareMinusIcon, SquarePlusIcon } from "lucide-react";
|
|
3
|
+
import type { SchemaObject } from "../../../../oas/parser/index.js";
|
|
4
|
+
import { Card } from "../../../../ui/Card.js";
|
|
5
|
+
import type { LogicalGroupType } from "../utils.js";
|
|
6
|
+
import { LogicalGroupItem } from "./LogicalGroupItem.js";
|
|
7
|
+
|
|
8
|
+
const typeLabel = {
|
|
9
|
+
AND: "All of",
|
|
10
|
+
OR: "Any of",
|
|
11
|
+
ONE: "One of",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const LogicalGroup = ({
|
|
15
|
+
schemas,
|
|
16
|
+
type,
|
|
17
|
+
isOpen,
|
|
18
|
+
level,
|
|
19
|
+
toggleOpen,
|
|
20
|
+
}: {
|
|
21
|
+
schemas: SchemaObject[];
|
|
22
|
+
type: LogicalGroupType;
|
|
23
|
+
isOpen: boolean;
|
|
24
|
+
toggleOpen: () => void;
|
|
25
|
+
level: number;
|
|
26
|
+
}) => (
|
|
27
|
+
<Collapsible.Root open={isOpen} onOpenChange={toggleOpen} asChild>
|
|
28
|
+
<Card className="px-6">
|
|
29
|
+
<Collapsible.Trigger className="flex gap-2 items-center py-2 w-full text-sm text-muted-foreground -translate-x-1.5">
|
|
30
|
+
{isOpen ? <SquareMinusIcon size={14} /> : <SquarePlusIcon size={14} />}
|
|
31
|
+
<span>{typeLabel[type]}</span>
|
|
32
|
+
</Collapsible.Trigger>
|
|
33
|
+
|
|
34
|
+
<Collapsible.Content className="pb-4">
|
|
35
|
+
{schemas.map((subSchema, index) => (
|
|
36
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
37
|
+
<LogicalGroupItem
|
|
38
|
+
key={index}
|
|
39
|
+
type={type}
|
|
40
|
+
schema={subSchema}
|
|
41
|
+
level={level}
|
|
42
|
+
/>
|
|
43
|
+
))}
|
|
44
|
+
</Collapsible.Content>
|
|
45
|
+
</Card>
|
|
46
|
+
</Collapsible.Root>
|
|
47
|
+
);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChevronDownIcon,
|
|
3
|
+
CircleDotIcon,
|
|
4
|
+
CircleFadingPlusIcon,
|
|
5
|
+
CircleIcon,
|
|
6
|
+
} from "lucide-react";
|
|
7
|
+
import { cn } from "../../../../util/cn.js";
|
|
8
|
+
|
|
9
|
+
import type { LogicalGroupType } from "../utils.js";
|
|
10
|
+
|
|
11
|
+
const iconMap = {
|
|
12
|
+
AND: <CircleFadingPlusIcon size={16} className="fill-card" />,
|
|
13
|
+
OR: <CircleDotIcon size={16} className="fill-card" />,
|
|
14
|
+
ONE: <CircleIcon size={14} className="fill-card" />,
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
const colorClass = {
|
|
18
|
+
AND: "text-green-500 dark:text-green-300/60",
|
|
19
|
+
OR: "text-blue-400 dark:text-blue-500",
|
|
20
|
+
ONE: "text-purple-500 dark:text-purple-300/60",
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
export const LogicalGroupConnector = ({
|
|
24
|
+
type,
|
|
25
|
+
isOpen,
|
|
26
|
+
className,
|
|
27
|
+
}: {
|
|
28
|
+
type: LogicalGroupType;
|
|
29
|
+
isOpen: boolean;
|
|
30
|
+
className?: string;
|
|
31
|
+
}) => {
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
className={cn(
|
|
35
|
+
colorClass[type],
|
|
36
|
+
"relative text-sm flex py-2",
|
|
37
|
+
"before:border-l before:absolute before:-top-2 before:-bottom-2 before:border-border before:border-dashed before:content-['']",
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
>
|
|
41
|
+
<div className="-translate-x-[7px] flex gap-1 items-center">
|
|
42
|
+
{iconMap[type]}
|
|
43
|
+
<div
|
|
44
|
+
className={cn(
|
|
45
|
+
"translate-y-px mx-px opacity-0 group-hover:opacity-100 transition",
|
|
46
|
+
!isOpen && "-rotate-90",
|
|
47
|
+
)}
|
|
48
|
+
>
|
|
49
|
+
<ChevronDownIcon size={16} />
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import type { SchemaObject } from "../../../../oas/parser/index.js";
|
|
4
|
+
import { SchemaView } from "../SchemaView.js";
|
|
5
|
+
import type { LogicalGroupType } from "../utils.js";
|
|
6
|
+
import { LogicalGroupConnector } from "./LogicalGroupConnector.js";
|
|
7
|
+
|
|
8
|
+
export const LogicalGroupItem = (props: {
|
|
9
|
+
type: LogicalGroupType;
|
|
10
|
+
schema: SchemaObject;
|
|
11
|
+
level: number;
|
|
12
|
+
}) => {
|
|
13
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Collapsible.Root
|
|
17
|
+
open={isOpen}
|
|
18
|
+
onOpenChange={() => setIsOpen((prev) => !prev)}
|
|
19
|
+
className="group"
|
|
20
|
+
>
|
|
21
|
+
<Collapsible.Trigger>
|
|
22
|
+
<LogicalGroupConnector type={props.type} isOpen={isOpen} />
|
|
23
|
+
</Collapsible.Trigger>
|
|
24
|
+
{!isOpen && <div className="wavy-line bg-border translate-y-1" />}
|
|
25
|
+
<Collapsible.Content>
|
|
26
|
+
<SchemaView schema={props.schema} level={props.level + 1} />
|
|
27
|
+
</Collapsible.Content>
|
|
28
|
+
</Collapsible.Root>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
2
2
|
import { ListPlusIcon } from "lucide-react";
|
|
3
|
-
import { useState } from "react";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
4
|
import { Markdown, ProseClasses } from "../../../components/Markdown.js";
|
|
5
5
|
import type { SchemaObject } from "../../../oas/parser/index.js";
|
|
6
6
|
import { Button } from "../../../ui/Button.js";
|
|
7
7
|
import { cn } from "../../../util/cn.js";
|
|
8
|
+
import { objectEntries } from "../../../util/objectEntries.js";
|
|
9
|
+
import { LogicalGroup } from "./LogicalGroup/LogicalGroup.js";
|
|
8
10
|
import { SchemaView } from "./SchemaView.js";
|
|
9
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
hasLogicalGroupings,
|
|
13
|
+
isComplexType,
|
|
14
|
+
LogicalSchemaTypeMap,
|
|
15
|
+
} from "./utils.js";
|
|
10
16
|
|
|
11
17
|
export const SchemaLogicalGroup = ({
|
|
12
18
|
schema,
|
|
@@ -15,41 +21,34 @@ export const SchemaLogicalGroup = ({
|
|
|
15
21
|
schema: SchemaObject;
|
|
16
22
|
level: number;
|
|
17
23
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
groupName: string,
|
|
21
|
-
separator: string,
|
|
22
|
-
) => {
|
|
23
|
-
return group.map((subSchema, index) => (
|
|
24
|
-
<div key={index} className="my-2">
|
|
25
|
-
<strong>{groupName}</strong>
|
|
26
|
-
<div className="mt-2">
|
|
27
|
-
<SchemaView schema={subSchema} level={level + 1} />
|
|
28
|
-
{index < group.length - 1 && (
|
|
29
|
-
<div className="text-center my-2">{separator}</div>
|
|
30
|
-
)}
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
));
|
|
34
|
-
};
|
|
24
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
25
|
+
const toggleOpen = useCallback(() => setIsOpen((prev) => !prev), []);
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (schema.anyOf) return renderLogicalGroup(schema.anyOf, "Any of", "OR");
|
|
27
|
+
for (const [key, type] of objectEntries(LogicalSchemaTypeMap)) {
|
|
28
|
+
if (!schema[key]) continue;
|
|
39
29
|
|
|
40
|
-
|
|
30
|
+
return (
|
|
31
|
+
<LogicalGroup
|
|
32
|
+
schemas={schema[key]}
|
|
33
|
+
type={type}
|
|
34
|
+
isOpen={isOpen}
|
|
35
|
+
toggleOpen={toggleOpen}
|
|
36
|
+
level={level}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
41
40
|
};
|
|
42
41
|
|
|
43
42
|
export const SchemaPropertyItem = ({
|
|
44
43
|
name,
|
|
45
|
-
|
|
44
|
+
schema,
|
|
46
45
|
group,
|
|
47
46
|
level,
|
|
48
47
|
defaultOpen = false,
|
|
49
48
|
showCollapseButton = true,
|
|
50
49
|
}: {
|
|
51
50
|
name: string;
|
|
52
|
-
|
|
51
|
+
schema: SchemaObject;
|
|
53
52
|
group: "required" | "optional" | "deprecated";
|
|
54
53
|
level: number;
|
|
55
54
|
defaultOpen?: boolean;
|
|
@@ -63,12 +62,12 @@ export const SchemaPropertyItem = ({
|
|
|
63
62
|
<div className="flex gap-2 items-center">
|
|
64
63
|
<code>{name}</code>
|
|
65
64
|
<span className="text-muted-foreground">
|
|
66
|
-
{
|
|
67
|
-
<span>{
|
|
68
|
-
) : Array.isArray(
|
|
69
|
-
<span>{
|
|
65
|
+
{schema.type === "array" && schema.items?.type ? (
|
|
66
|
+
<span>{schema.items.type}[]</span>
|
|
67
|
+
) : Array.isArray(schema.type) ? (
|
|
68
|
+
<span>{schema.type.join(" | ")}</span>
|
|
70
69
|
) : (
|
|
71
|
-
<span>{
|
|
70
|
+
<span>{schema.type}</span>
|
|
72
71
|
)}
|
|
73
72
|
</span>
|
|
74
73
|
{group === "optional" && (
|
|
@@ -78,14 +77,14 @@ export const SchemaPropertyItem = ({
|
|
|
78
77
|
)}
|
|
79
78
|
</div>
|
|
80
79
|
|
|
81
|
-
{
|
|
80
|
+
{schema.description && (
|
|
82
81
|
<Markdown
|
|
83
82
|
className={cn(ProseClasses, "text-sm leading-normal line-clamp-4")}
|
|
84
|
-
content={
|
|
83
|
+
content={schema.description}
|
|
85
84
|
/>
|
|
86
85
|
)}
|
|
87
86
|
|
|
88
|
-
{(hasLogicalGroupings(
|
|
87
|
+
{(hasLogicalGroupings(schema) || isComplexType(schema)) && (
|
|
89
88
|
<Collapsible.Root
|
|
90
89
|
defaultOpen={defaultOpen}
|
|
91
90
|
open={isOpen}
|
|
@@ -107,14 +106,15 @@ export const SchemaPropertyItem = ({
|
|
|
107
106
|
)}
|
|
108
107
|
<Collapsible.Content>
|
|
109
108
|
<div className="mt-2">
|
|
110
|
-
{hasLogicalGroupings(
|
|
111
|
-
<SchemaLogicalGroup schema={
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
{hasLogicalGroupings(schema) ? (
|
|
110
|
+
<SchemaLogicalGroup schema={schema} level={level + 1} />
|
|
111
|
+
) : schema.type === "object" ? (
|
|
112
|
+
<SchemaView schema={schema} level={level + 1} />
|
|
113
|
+
) : (
|
|
114
|
+
schema.type === "array" &&
|
|
115
|
+
typeof schema.items === "object" && (
|
|
116
|
+
<SchemaView schema={schema.items} level={level + 1} />
|
|
117
|
+
)
|
|
118
118
|
)}
|
|
119
119
|
</div>
|
|
120
120
|
</Collapsible.Content>
|
|
@@ -111,11 +111,11 @@ export const SchemaView = ({
|
|
|
111
111
|
(group) =>
|
|
112
112
|
groupedProperties[group] && (
|
|
113
113
|
<ul key={group} className="divide-y">
|
|
114
|
-
{groupedProperties[group].map(([
|
|
114
|
+
{groupedProperties[group].map(([name, schema]) => (
|
|
115
115
|
<SchemaPropertyItem
|
|
116
|
-
key={
|
|
117
|
-
name={
|
|
118
|
-
|
|
116
|
+
key={name}
|
|
117
|
+
name={name}
|
|
118
|
+
schema={schema}
|
|
119
119
|
group={group}
|
|
120
120
|
level={level}
|
|
121
121
|
defaultOpen={isTopLevelSingleItem || defaultOpen}
|
|
@@ -8,3 +8,11 @@ export const isComplexType = (value: SchemaObject) =>
|
|
|
8
8
|
|
|
9
9
|
export const hasLogicalGroupings = (value: SchemaObject) =>
|
|
10
10
|
Boolean(value.oneOf ?? value.allOf ?? value.anyOf);
|
|
11
|
+
|
|
12
|
+
export const LogicalSchemaTypeMap = {
|
|
13
|
+
allOf: "AND",
|
|
14
|
+
anyOf: "OR",
|
|
15
|
+
oneOf: "ONE",
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
export type LogicalGroupType = "AND" | "OR" | "ONE";
|