zudoku 0.1.1-dev.42 → 0.1.1-dev.44
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/DevPortal.d.ts +1 -2
- package/dist/lib/components/DevPortal.js +2 -2
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/components/Layout.js +2 -1
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/Spinner.d.ts +3 -0
- package/dist/lib/components/Spinner.js +4 -0
- package/dist/lib/components/Spinner.js.map +1 -0
- package/dist/lib/components/navigation/SideNavigation.js +1 -1
- package/dist/lib/components/navigation/SideNavigation.js.map +1 -1
- package/dist/lib/components/navigation/SideNavigationWrapper.d.ts +1 -1
- package/dist/lib/components/navigation/SideNavigationWrapper.js +1 -1
- package/dist/lib/components/navigation/SideNavigationWrapper.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +2 -0
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +3 -3
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.js +3 -2
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js +0 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -1
- package/lib/{util-CnHdxZvn.js → Spinner-Zry2k_pD.js} +278 -268
- package/lib/zudoku.components.js +91 -85
- package/lib/zudoku.plugins.js +162 -149
- package/package.json +1 -1
- package/src/lib/components/DevPortal.tsx +2 -2
- package/src/lib/components/Layout.tsx +9 -3
- package/src/lib/components/Spinner.tsx +5 -0
- package/src/lib/components/navigation/SideNavigation.tsx +1 -1
- package/src/lib/components/navigation/SideNavigationWrapper.tsx +7 -3
- package/src/lib/plugins/openapi/OperationList.tsx +3 -0
- package/src/lib/plugins/openapi/OperationListItem.tsx +14 -4
- package/src/lib/plugins/openapi/playground/Playground.tsx +2 -1
- package/src/lib/plugins/openapi/util/generateSchemaExample.ts +0 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MDXProvider
|
|
1
|
+
import { MDXProvider } from "@mdx-js/react";
|
|
2
2
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
3
3
|
import { memo, Suspense, useEffect, useMemo } from "react";
|
|
4
4
|
import { type AuthProvider } from "../authentication/authentication.js";
|
|
@@ -93,4 +93,4 @@ const DevPortalInner = (props: DevPortalProps) => {
|
|
|
93
93
|
const DevPortal = memo(DevPortalInner);
|
|
94
94
|
DevPortal.displayName = "DevPortal";
|
|
95
95
|
|
|
96
|
-
export { DevPortal
|
|
96
|
+
export { DevPortal };
|
|
@@ -7,7 +7,7 @@ import { Header } from "./Header.js";
|
|
|
7
7
|
import { useDevPortal } from "./context/DevPortalProvider.js";
|
|
8
8
|
import { useViewportAnchor } from "./context/ViewportAnchorContext.js";
|
|
9
9
|
import { SideNavigation } from "./navigation/SideNavigation.js";
|
|
10
|
-
import {
|
|
10
|
+
import { Spinner } from "./Spinner.js";
|
|
11
11
|
|
|
12
12
|
export const Layout = ({ children }: { children?: ReactNode }) => {
|
|
13
13
|
const location = useLocation();
|
|
@@ -42,8 +42,14 @@ export const Layout = ({ children }: { children?: ReactNode }) => {
|
|
|
42
42
|
</Helmet>
|
|
43
43
|
<Header />
|
|
44
44
|
|
|
45
|
-
<div className="max-w-screen-2xl mx-auto pt-[--header-height] px-10 lg:px-12">
|
|
46
|
-
<Suspense
|
|
45
|
+
<div className="max-w-screen-2xl mx-auto pt-[--header-height] px-10 lg:px-12 h-full">
|
|
46
|
+
<Suspense
|
|
47
|
+
fallback={
|
|
48
|
+
<div className="grid h-full place-items-center">
|
|
49
|
+
<Spinner />
|
|
50
|
+
</div>
|
|
51
|
+
}
|
|
52
|
+
>
|
|
47
53
|
<SideNavigation />
|
|
48
54
|
<main
|
|
49
55
|
className="dark:border-white/10 translate-x-0
|
|
@@ -11,7 +11,7 @@ export const SideNavigation = () => {
|
|
|
11
11
|
return (
|
|
12
12
|
<SideNavigationWrapper
|
|
13
13
|
ref={navRef}
|
|
14
|
-
|
|
14
|
+
pushMainContent={navigation.data.items.length > 0}
|
|
15
15
|
>
|
|
16
16
|
{navigation.data.items.map((category) => (
|
|
17
17
|
<SideNavigationCategory key={category.label} category={category} />
|
|
@@ -3,10 +3,14 @@ import { cn } from "../../util/cn.js";
|
|
|
3
3
|
|
|
4
4
|
export const SideNavigationWrapper = forwardRef<
|
|
5
5
|
HTMLDivElement,
|
|
6
|
-
PropsWithChildren<{
|
|
7
|
-
>(({ children, className,
|
|
6
|
+
PropsWithChildren<{ pushMainContent?: boolean; className?: string }>
|
|
7
|
+
>(({ children, className, pushMainContent }, ref) => (
|
|
8
8
|
<nav
|
|
9
|
-
data
|
|
9
|
+
// this data attribute is used in `Layout.tsx` to determine if side navigation
|
|
10
|
+
// is present for the current page so the main content is pushed to the right
|
|
11
|
+
// it's also important to set `peer` class here.
|
|
12
|
+
// maybe this could be simplified by adjusting the layout
|
|
13
|
+
data-navigation={String(pushMainContent)}
|
|
10
14
|
className={cn(
|
|
11
15
|
"peer hidden lg:flex flex-col fixed text-sm overflow-y-auto shrink-0 p-[--padding-nav-item] -mx-[--padding-nav-item] pb-20 pt-[--padding-content-top] w-[--side-nav-width] h-[calc(100%-var(--header-height))] scroll-pt-2 gap-2",
|
|
12
16
|
className,
|
|
@@ -72,12 +72,15 @@ const AllOperationsQuery = graphql(/* GraphQL */ `
|
|
|
72
72
|
}
|
|
73
73
|
`);
|
|
74
74
|
|
|
75
|
+
const suspenseContext = { suspense: true };
|
|
76
|
+
|
|
75
77
|
export const OperationList = () => {
|
|
76
78
|
const { type, input } = useOasConfig();
|
|
77
79
|
|
|
78
80
|
const [result] = useQuery({
|
|
79
81
|
query: AllOperationsQuery,
|
|
80
82
|
variables: { type, input },
|
|
83
|
+
context: suspenseContext,
|
|
81
84
|
});
|
|
82
85
|
|
|
83
86
|
if (!result.data) return null;
|
|
@@ -53,19 +53,25 @@ export const OperationListItem = ({
|
|
|
53
53
|
</div>
|
|
54
54
|
)}
|
|
55
55
|
<Heading level={3} className="capitalize">
|
|
56
|
-
|
|
56
|
+
Responses
|
|
57
57
|
</Heading>
|
|
58
58
|
<Tabs defaultValue={`${first?.statusCode}${first?.description}`}>
|
|
59
59
|
<TabsList>
|
|
60
60
|
{operation.responses.map((response) => (
|
|
61
|
-
<TabsTrigger
|
|
61
|
+
<TabsTrigger
|
|
62
|
+
value={response.statusCode + response.description}
|
|
63
|
+
key={response.statusCode}
|
|
64
|
+
>
|
|
62
65
|
{response.description} ({response.statusCode})
|
|
63
66
|
</TabsTrigger>
|
|
64
67
|
))}
|
|
65
68
|
</TabsList>
|
|
66
69
|
<ul className="list-none m-0 px-0 overflow-hidden">
|
|
67
70
|
{operation.responses.map((response) => (
|
|
68
|
-
<TabsContent
|
|
71
|
+
<TabsContent
|
|
72
|
+
value={response.statusCode + response.description}
|
|
73
|
+
key={response.statusCode}
|
|
74
|
+
>
|
|
69
75
|
<ViewSchema schema={response.content?.at(0)?.schema} name="" />
|
|
70
76
|
</TabsContent>
|
|
71
77
|
))}
|
|
@@ -121,6 +127,7 @@ const ViewSchema = ({
|
|
|
121
127
|
.concat(additionalProperties)
|
|
122
128
|
.map(([propertyName, property]) => (
|
|
123
129
|
<div
|
|
130
|
+
key={propertyName}
|
|
124
131
|
className={cn(
|
|
125
132
|
level > 0 ? "py-2" : "py-4",
|
|
126
133
|
"px-2 border-t border-border bg-border/20 hover:bg-border/30 flex gap-1 flex-col",
|
|
@@ -166,7 +173,10 @@ const ViewSchema = ({
|
|
|
166
173
|
{property.enum
|
|
167
174
|
.filter((value) => value)
|
|
168
175
|
.map((value) => (
|
|
169
|
-
<span
|
|
176
|
+
<span
|
|
177
|
+
key={value}
|
|
178
|
+
className="font-mono text-xs border-border border bg-muted rounded px-1"
|
|
179
|
+
>
|
|
170
180
|
{value}
|
|
171
181
|
</span>
|
|
172
182
|
))}
|
|
@@ -21,6 +21,7 @@ import { CirclePlayIcon, LoaderCircle, MonitorCheckIcon } from "lucide-react";
|
|
|
21
21
|
import { createUrl } from "./createUrl.js";
|
|
22
22
|
import { UrlDisplay } from "./UrlDisplay.js";
|
|
23
23
|
import { useApiIdentities } from "../../../components/context/DevPortalProvider.js";
|
|
24
|
+
import { Spinner } from "../../../components/Spinner.js";
|
|
24
25
|
|
|
25
26
|
function mimeTypeToLanguage(mimeType: string) {
|
|
26
27
|
const mimeTypeMapping = {
|
|
@@ -305,7 +306,7 @@ const Playground = ({
|
|
|
305
306
|
<div className="grid place-items-center h-full">
|
|
306
307
|
<span className="text-[16px] font-semibold text-muted-foreground">
|
|
307
308
|
{queryMutation.isPending ? (
|
|
308
|
-
<
|
|
309
|
+
<Spinner />
|
|
309
310
|
) : (
|
|
310
311
|
"Send a request first to see the response here"
|
|
311
312
|
)}
|
|
@@ -38,7 +38,6 @@ function processComplexTypes(schema: SchemaObject, name?: string): any {
|
|
|
38
38
|
});
|
|
39
39
|
return obj;
|
|
40
40
|
} else if (schema.type === "array" && schema.items) {
|
|
41
|
-
console.log(name, "array", schema.items, schema);
|
|
42
41
|
const value = generateSchemaExample(schema.items, name);
|
|
43
42
|
if (value !== undefined) {
|
|
44
43
|
return [value];
|