zudoku 0.1.1-dev.0 → 0.1.1-dev.10
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/cli.js +2 -0
- package/dist/app/App.js +20 -0
- package/dist/app/App.js.map +1 -0
- package/dist/app/DevPortal.d.ts +0 -1
- package/dist/app/authentication/openid.js +2 -2
- package/dist/app/authentication/openid.js.map +1 -1
- package/dist/app/components/Dialog.d.ts +19 -0
- package/dist/app/components/Dialog.js +23 -0
- package/dist/app/components/Dialog.js.map +1 -0
- package/dist/app/components/Header.d.ts +0 -1
- package/dist/app/components/Input.d.ts +5 -0
- package/dist/app/components/Input.js +9 -0
- package/dist/app/components/Input.js.map +1 -0
- package/dist/app/components/SyntaxHighlight.js +2 -0
- package/dist/app/components/SyntaxHighlight.js.map +1 -1
- package/dist/app/components/context/DevPortalProvider.d.ts +0 -1
- package/dist/app/components/navigation/SideNavigationWrapper.d.ts +1 -2
- package/dist/app/components/navigation/useNavigationCollapsibleState.d.ts +0 -1
- package/dist/app/main.js +3 -15
- package/dist/app/main.js.map +1 -1
- package/dist/app/plugins/markdown/index.d.ts +0 -1
- package/dist/app/plugins/openapi/ColorizedParam.d.ts +5 -1
- package/dist/app/plugins/openapi/ColorizedParam.js +10 -5
- package/dist/app/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/app/plugins/openapi/MakeRequest.js +18 -6
- package/dist/app/plugins/openapi/MakeRequest.js.map +1 -1
- package/dist/app/plugins/openapi/OperationList.d.ts +2 -45
- package/dist/app/plugins/openapi/OperationList.js +16 -16
- package/dist/app/plugins/openapi/OperationList.js.map +1 -1
- package/dist/app/plugins/openapi/OperationListItem.d.ts +2 -2
- package/dist/app/plugins/openapi/OperationListItem.js +2 -2
- package/dist/app/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/app/plugins/openapi/RequestBodySidecarBox.js +8 -8
- package/dist/app/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/app/plugins/openapi/ResponsesSidecarBox.js +1 -1
- package/dist/app/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/app/plugins/openapi/Sidecar.js +73 -18
- package/dist/app/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/app/plugins/openapi/SidecarBox.d.ts +3 -5
- package/dist/app/plugins/openapi/SidecarBox.js +3 -5
- package/dist/app/plugins/openapi/SidecarBox.js.map +1 -1
- package/dist/app/plugins/openapi/graphql/fragment-masking.d.ts +19 -0
- package/dist/app/plugins/openapi/graphql/fragment-masking.js +16 -0
- package/dist/app/plugins/openapi/graphql/fragment-masking.js.map +1 -0
- package/dist/app/plugins/openapi/graphql/gql.d.ts +58 -0
- package/dist/app/plugins/openapi/graphql/gql.js +22 -0
- package/dist/app/plugins/openapi/graphql/gql.js.map +1 -0
- package/dist/app/plugins/openapi/graphql/graphql.d.ts +282 -0
- package/dist/app/plugins/openapi/graphql/graphql.js +526 -0
- package/dist/app/plugins/openapi/graphql/graphql.js.map +1 -0
- package/dist/app/plugins/openapi/graphql/index.d.ts +2 -836
- package/dist/app/plugins/openapi/graphql/index.js +2 -3
- package/dist/app/plugins/openapi/graphql/index.js.map +1 -1
- package/dist/app/plugins/openapi/index.d.ts +0 -1
- package/dist/app/plugins/openapi/playground/Playground.d.ts +8 -0
- package/dist/app/plugins/openapi/playground/Playground.js +98 -0
- package/dist/app/plugins/openapi/playground/Playground.js.map +1 -0
- package/dist/app/plugins/openapi/util/urql.d.ts +0 -1
- package/dist/app/ui/Button.d.ts +11 -0
- package/dist/app/ui/Button.js +34 -0
- package/dist/app/ui/Button.js.map +1 -0
- package/dist/app/ui/Card.js +1 -1
- package/dist/app/ui/Card.js.map +1 -1
- package/dist/app/ui/Tabs.d.ts +7 -0
- package/dist/app/ui/Tabs.js +13 -0
- package/dist/app/ui/Tabs.js.map +1 -0
- package/dist/app/util/MdxComponents.d.ts +2 -2
- package/dist/app/util/createVariantComponent.d.ts +15 -0
- package/dist/app/util/createVariantComponent.js +12 -0
- package/dist/app/util/createVariantComponent.js.map +1 -0
- package/dist/app/util/createWaitForNotify.d.ts +1 -1
- package/dist/app/util/slugify.d.ts +0 -1
- package/dist/cli/cmds/dev.js +0 -1
- package/dist/cli/cmds/dev.js.map +1 -1
- package/dist/cli/common/logger.d.ts +1 -2
- package/dist/cli/common/logger.js +2 -4
- package/dist/cli/common/logger.js.map +1 -1
- package/dist/cli/dev/handler.d.ts +1 -1
- package/dist/cli/dev/handler.js +11 -2
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/config/config.d.ts +11 -5
- package/dist/ts.d.ts +6 -0
- package/dist/ts.js +62 -0
- package/dist/ts.js.map +1 -0
- package/dist/vite/config.d.ts +1 -0
- package/dist/vite/config.js +80 -16
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/config.test.d.ts +1 -0
- package/dist/vite/config.test.js +10 -0
- package/dist/vite/config.test.js.map +1 -0
- package/dist/vite/dev-server.js +3 -2
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/html.d.ts +1 -1
- package/dist/vite/html.js +2 -3
- package/dist/vite/html.js.map +1 -1
- package/dist/vite/plugin-api.d.ts +4 -0
- package/dist/vite/plugin-api.js +47 -0
- package/dist/vite/plugin-api.js.map +1 -0
- package/dist/vite/plugin-auth.d.ts +4 -0
- package/dist/vite/plugin-auth.js +29 -0
- package/dist/vite/plugin-auth.js.map +1 -0
- package/dist/vite/plugin-config.d.ts +6 -0
- package/dist/vite/plugin-config.js +24 -0
- package/dist/vite/plugin-config.js.map +1 -0
- package/dist/vite/plugin-docs.d.ts +4 -0
- package/dist/vite/plugin-docs.js +43 -0
- package/dist/vite/plugin-docs.js.map +1 -0
- package/dist/vite/plugin-docs.test.d.ts +1 -0
- package/dist/vite/plugin-docs.test.js +31 -0
- package/dist/vite/plugin-docs.test.js.map +1 -0
- package/dist/vite/plugin-html.d.ts +3 -0
- package/dist/vite/plugin-html.js +50 -0
- package/dist/vite/plugin-html.js.map +1 -0
- package/dist/vite/plugin-mdx.d.ts +8 -0
- package/dist/vite/plugin-mdx.js +61 -0
- package/dist/vite/plugin-mdx.js.map +1 -0
- package/dist/vite/plugin-metadata.d.ts +6 -0
- package/dist/vite/plugin-metadata.js +24 -0
- package/dist/vite/plugin-metadata.js.map +1 -0
- package/dist/vite/plugin.d.ts +2 -6
- package/dist/vite/plugin.js +14 -104
- package/dist/vite/plugin.js.map +1 -1
- package/package.json +32 -22
- package/src/app/App.tsx +30 -0
- package/src/app/components/Dialog.tsx +119 -0
- package/src/app/components/Input.tsx +24 -0
- package/src/app/components/SyntaxHighlight.tsx +2 -0
- package/src/app/main.tsx +3 -16
- package/src/app/plugins/openapi/ColorizedParam.tsx +18 -9
- package/src/app/plugins/openapi/MakeRequest.tsx +19 -0
- package/src/app/plugins/openapi/OperationList.tsx +20 -22
- package/src/app/plugins/openapi/OperationListItem.tsx +3 -3
- package/src/app/plugins/openapi/RequestBodySidecarBox.tsx +31 -28
- package/src/app/plugins/openapi/ResponsesSidecarBox.tsx +1 -1
- package/src/app/plugins/openapi/Sidecar.tsx +81 -20
- package/src/app/plugins/openapi/SidecarBox.tsx +30 -29
- package/src/app/plugins/openapi/graphql/fragment-masking.ts +111 -0
- package/src/app/plugins/openapi/graphql/gql.ts +70 -0
- package/src/app/plugins/openapi/graphql/graphql.ts +795 -0
- package/src/app/plugins/openapi/graphql/index.ts +2 -13
- package/src/app/plugins/openapi/playground/Playground.tsx +309 -0
- package/src/app/plugins/openapi/queries.graphql +6 -0
- package/src/app/ui/Button.tsx +56 -0
- package/src/app/ui/Card.tsx +1 -1
- package/src/app/ui/Tabs.tsx +52 -0
- package/src/app/util/createVariantComponent.tsx +30 -0
- package/dist/app/app.js +0 -69
- package/dist/app/app.js.map +0 -1
- package/dist/app/config.d.ts +0 -3
- package/dist/app/config.js +0 -9
- package/dist/app/config.js.map +0 -1
- package/dist/app/markdowns.d.ts +0 -3
- package/dist/app/markdowns.js +0 -5
- package/dist/app/markdowns.js.map +0 -1
- package/dist/app/plugins/openapi/util/getCode.d.ts +0 -2
- package/dist/app/plugins/openapi/util/getCode.js +0 -54
- package/dist/app/plugins/openapi/util/getCode.js.map +0 -1
- package/src/app/app.tsx +0 -85
- package/src/app/config.ts +0 -20
- package/src/app/markdowns.ts +0 -7
- package/src/app/plugins/openapi/graphql/env.d.ts +0 -48
- package/src/app/plugins/openapi/util/getCode.tsx +0 -69
- /package/dist/app/{app.d.ts → App.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-metadata.js","sourceRoot":"","sources":["../../src/vite/plugin-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;GAEG;AACH,MAAM,iBAAiB,GAAG,GAAW,EAAE;IACrC,OAAO;QACL,IAAI,EAAE,mCAAmC;QACzC,QAAQ;YACN,MAAM,IAAI,GAAG,EAAE,CAAC;YAChB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;gBACrC,MAAM,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;gBACjC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;oBAC/B,KAAK,MAAM,MAAM,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;wBACnC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;oBACtC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,aAAa,CACX,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAClC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAC9B,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/dist/vite/plugin.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { type Options } from "@mdx-js/rollup";
|
|
2
1
|
import { type PluginOption } from "vite";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
rehypePlugins?: Options["rehypePlugins"];
|
|
6
|
-
};
|
|
7
|
-
export declare const devPortalPlugin: ({ remarkPlugins, rehypePlugins, }?: DevPortalPluginOptions) => PluginOption[];
|
|
2
|
+
import { ZudokuPluginOptions } from "../config/config.js";
|
|
3
|
+
export default function vitePlugin(config: ZudokuPluginOptions): PluginOption[];
|
package/dist/vite/plugin.js
CHANGED
|
@@ -1,109 +1,19 @@
|
|
|
1
|
-
import rehypeMetaAsAttributes from "@lekoarts/rehype-meta-as-attributes";
|
|
2
|
-
import mdx from "@mdx-js/rollup";
|
|
3
|
-
import withToc from "@stefanprobst/rehype-extract-toc";
|
|
4
|
-
import withTocExport from "@stefanprobst/rehype-extract-toc/mdx";
|
|
5
1
|
import react from "@vitejs/plugin-react";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
|
|
14
|
-
import { visit } from "unist-util-visit";
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
-
const rehypeCodeBlockPlugin = () => (tree) => {
|
|
17
|
-
visit(tree, "element", (node, index, parent) => {
|
|
18
|
-
if (node.tagName === "code") {
|
|
19
|
-
node.properties.inline = parent?.tagName !== "pre";
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
-
const remarkLinkRewritePlugin = () => (tree) => {
|
|
25
|
-
visit(tree, "link", (node) => {
|
|
26
|
-
if (!node.url)
|
|
27
|
-
return;
|
|
28
|
-
if (!node.url.startsWith("http") && !node.url.startsWith("/")) {
|
|
29
|
-
node.url = path.join("../", node.url);
|
|
30
|
-
}
|
|
31
|
-
node.url = node.url.replace(/\.mdx?(#.*?)?/, "$1");
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
const themeScript = `
|
|
35
|
-
if (
|
|
36
|
-
localStorage.getItem("theme") === "dark" ||
|
|
37
|
-
(!("theme" in localStorage) &&
|
|
38
|
-
window.matchMedia("(prefers-color-scheme: dark)").matches)
|
|
39
|
-
) {
|
|
40
|
-
document.documentElement.classList.add("dark");
|
|
41
|
-
} else {
|
|
42
|
-
document.documentElement.classList.remove("dark");
|
|
43
|
-
}
|
|
44
|
-
`.trim();
|
|
45
|
-
export const devPortalPlugin = ({ remarkPlugins, rehypePlugins, } = {}) => {
|
|
2
|
+
import viteApiPlugin from "./plugin-api.js";
|
|
3
|
+
import viteAuthPlugin from "./plugin-auth.js";
|
|
4
|
+
import viteConfigPlugin from "./plugin-config.js";
|
|
5
|
+
import viteDocsPlugin from "./plugin-docs.js";
|
|
6
|
+
import viteHtmlPlugin from "./plugin-html.js";
|
|
7
|
+
import viteMdxPlugin from "./plugin-mdx.js";
|
|
8
|
+
export default function vitePlugin(config) {
|
|
46
9
|
return [
|
|
47
|
-
|
|
48
|
-
enforce: "pre",
|
|
49
|
-
...mdx({
|
|
50
|
-
providerImportSource: "@mdx-js/react",
|
|
51
|
-
remarkPlugins: [
|
|
52
|
-
remarkComment,
|
|
53
|
-
remarkGfm,
|
|
54
|
-
remarkFrontmatter,
|
|
55
|
-
remarkMdxFrontmatter,
|
|
56
|
-
remarkDirective,
|
|
57
|
-
remarkDirectiveRehype,
|
|
58
|
-
remarkLinkRewritePlugin,
|
|
59
|
-
...(remarkPlugins ?? []),
|
|
60
|
-
],
|
|
61
|
-
rehypePlugins: [
|
|
62
|
-
rehypeSlug,
|
|
63
|
-
rehypeCodeBlockPlugin,
|
|
64
|
-
rehypeMetaAsAttributes,
|
|
65
|
-
withToc,
|
|
66
|
-
withTocExport,
|
|
67
|
-
...(rehypePlugins ?? []),
|
|
68
|
-
],
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
10
|
+
viteMdxPlugin(config.build),
|
|
71
11
|
react({ include: /\.(mdx?|jsx?|tsx?)$/ }),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
transformIndexHtml: (html) => {
|
|
78
|
-
return {
|
|
79
|
-
html,
|
|
80
|
-
tags: [
|
|
81
|
-
{
|
|
82
|
-
tag: "script",
|
|
83
|
-
attrs: { type: "module" },
|
|
84
|
-
children: themeScript,
|
|
85
|
-
injectTo: "head",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
tag: "link",
|
|
89
|
-
attrs: {
|
|
90
|
-
rel: "preconnect",
|
|
91
|
-
href: "https://cdn.zuplo.com/",
|
|
92
|
-
},
|
|
93
|
-
injectTo: "head",
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
tag: "link",
|
|
97
|
-
attrs: {
|
|
98
|
-
rel: "stylesheet",
|
|
99
|
-
href: "https://cdn.zuplo.com/static/fonts/geist.css",
|
|
100
|
-
},
|
|
101
|
-
injectTo: "head",
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
},
|
|
12
|
+
viteHtmlPlugin(),
|
|
13
|
+
viteConfigPlugin(config),
|
|
14
|
+
viteAuthPlugin(config),
|
|
15
|
+
viteDocsPlugin(config),
|
|
16
|
+
viteApiPlugin(config),
|
|
107
17
|
];
|
|
108
|
-
}
|
|
18
|
+
}
|
|
109
19
|
//# sourceMappingURL=plugin.js.map
|
package/dist/vite/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/vite/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/vite/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,sBAAsB,CAAC;AAGzC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,MAA2B;IAE3B,OAAO;QACL,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,KAAK,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;QACzC,cAAc,EAAE;QAChB,gBAAgB,CAAC,MAAM,CAAC;QACxB,cAAc,CAAC,MAAM,CAAC;QACtB,cAAc,CAAC,MAAM,CAAC;QACtB,aAAa,CAAC,MAAM,CAAC;KACtB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zudoku",
|
|
3
|
-
"version": "0.1.1-dev.
|
|
3
|
+
"version": "0.1.1-dev.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -41,37 +41,42 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@cfworker/json-schema": "1.12.8",
|
|
44
|
-
"@clerk/clerk-js": "
|
|
44
|
+
"@clerk/clerk-js": "5.2.2",
|
|
45
|
+
"@graphql-typed-document-node/core": "3.2.0",
|
|
45
46
|
"@lekoarts/rehype-meta-as-attributes": "3.0.1",
|
|
46
47
|
"@mdx-js/react": "3.0.1",
|
|
47
48
|
"@mdx-js/rollup": "3.0.1",
|
|
48
49
|
"@pothos/core": "3.41.0",
|
|
49
50
|
"@radix-ui/react-collapsible": "1.0.3",
|
|
50
|
-
"@
|
|
51
|
+
"@radix-ui/react-dialog": "1.1.1",
|
|
52
|
+
"@radix-ui/react-slot": "1.1.0",
|
|
53
|
+
"@radix-ui/react-tabs": "1.1.0",
|
|
54
|
+
"@sentry/node": "8.11.0",
|
|
51
55
|
"@stefanprobst/rehype-extract-toc": "2.2.0",
|
|
52
56
|
"@tailwindcss/typography": "0.5.13",
|
|
53
57
|
"@tanstack/react-query": "5.35.1",
|
|
58
|
+
"@vitejs/plugin-react": "4.3.0",
|
|
59
|
+
"@zudoku/httpsnippet": "10.0.9",
|
|
54
60
|
"autoprefixer": "10.4.19",
|
|
55
|
-
"chalk": "
|
|
61
|
+
"chalk": "5.3.0",
|
|
56
62
|
"class-variance-authority": "0.7.0",
|
|
57
63
|
"clsx": "2.1.1",
|
|
58
|
-
"dotenv": "
|
|
59
|
-
"
|
|
60
|
-
"
|
|
64
|
+
"dotenv": "16.4.5",
|
|
65
|
+
"esbuild": "0.23.0",
|
|
66
|
+
"express": "4.19.2",
|
|
67
|
+
"graphql": "16.9.0",
|
|
61
68
|
"graphql-type-json": "0.3.2",
|
|
62
69
|
"graphql-yoga": "5.2.0",
|
|
63
70
|
"lru-cache": "10.2.0",
|
|
64
71
|
"lucide-react": "0.378.0",
|
|
65
|
-
"mdx": "
|
|
72
|
+
"mdx": "0.3.1",
|
|
66
73
|
"oauth4webapi": "2.10.4",
|
|
67
74
|
"object-hash": "3.0.0",
|
|
68
|
-
"
|
|
75
|
+
"openapi-types": "12.1.3",
|
|
69
76
|
"postcss": "8.4.38",
|
|
70
77
|
"posthog-node": "^4.0.1",
|
|
71
78
|
"prism-react-renderer": "2.3.1",
|
|
72
79
|
"prismjs": "1.29.0",
|
|
73
|
-
"react": "18.3.1",
|
|
74
|
-
"react-dom": "18.3.1",
|
|
75
80
|
"react-helmet-async": "2.0.5",
|
|
76
81
|
"react-markdown": "9.0.1",
|
|
77
82
|
"react-router-dom": "6.23.0",
|
|
@@ -82,22 +87,24 @@
|
|
|
82
87
|
"remark-frontmatter": "5.0.0",
|
|
83
88
|
"remark-gfm": "4.0.0",
|
|
84
89
|
"remark-mdx-frontmatter": "4.0.0",
|
|
85
|
-
"semver": "
|
|
90
|
+
"semver": "7.6.2",
|
|
86
91
|
"slugify": "1.6.6",
|
|
87
|
-
"strip-ansi": "
|
|
92
|
+
"strip-ansi": "7.1.0",
|
|
88
93
|
"tailwind-merge": "2.3.0",
|
|
89
94
|
"tailwindcss": "3.4.3",
|
|
90
95
|
"ulid": "2.3.0",
|
|
91
96
|
"unist-util-visit": "5.0.0",
|
|
92
97
|
"urql": "4.1.0",
|
|
93
|
-
"vite": "
|
|
94
|
-
"vite-plugin-dts": "
|
|
98
|
+
"vite": "5.3.1",
|
|
99
|
+
"vite-plugin-dts": "3.9.1",
|
|
95
100
|
"yaml": "2.4.1",
|
|
96
|
-
"yargs": "
|
|
97
|
-
"zustand": "
|
|
101
|
+
"yargs": "17.7.2",
|
|
102
|
+
"zustand": "4.5.4"
|
|
98
103
|
},
|
|
99
104
|
"devDependencies": {
|
|
105
|
+
"@graphql-codegen/cli": "^5.0.2",
|
|
100
106
|
"@types/express": "^4.17.21",
|
|
107
|
+
"@types/har-format": "^1.2.15",
|
|
101
108
|
"@types/json-schema": "7.0.15",
|
|
102
109
|
"@types/mdx": "2.0.13",
|
|
103
110
|
"@types/node": "20.12.10",
|
|
@@ -106,12 +113,15 @@
|
|
|
106
113
|
"@types/react-dom": "18.3.0",
|
|
107
114
|
"@types/semver": "^7.5.8",
|
|
108
115
|
"@types/yargs": "^17.0.32",
|
|
109
|
-
"
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
"typescript": "5.5.3"
|
|
117
|
+
},
|
|
118
|
+
"peerDependencies": {
|
|
119
|
+
"react": ">18.0.0",
|
|
120
|
+
"react-dom": ">18.0.0"
|
|
112
121
|
},
|
|
113
122
|
"scripts": {
|
|
114
|
-
"build": "tsc",
|
|
115
|
-
"
|
|
123
|
+
"build": "tsc --project tsconfig.node.json",
|
|
124
|
+
"test": "node --test --enable-source-maps",
|
|
125
|
+
"codegen": "graphql-codegen --config ./scripts/codegen.ts"
|
|
116
126
|
}
|
|
117
127
|
}
|
package/src/app/App.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "./main.css";
|
|
2
|
+
|
|
3
|
+
// Virtual config
|
|
4
|
+
import config from "virtual:zudoku-config";
|
|
5
|
+
|
|
6
|
+
// Virtual Plugins
|
|
7
|
+
import { configuredApiPlugins } from "virtual:zudoku-api-plugins";
|
|
8
|
+
import { configuredAuthProvider } from "virtual:zudoku-auth";
|
|
9
|
+
import { configuredDocsPlugins } from "virtual:zudoku-docs-plugins";
|
|
10
|
+
|
|
11
|
+
// Base React Component
|
|
12
|
+
import DevPortal from "./DevPortal.js";
|
|
13
|
+
|
|
14
|
+
export default function App() {
|
|
15
|
+
return (
|
|
16
|
+
<DevPortal
|
|
17
|
+
meta={{
|
|
18
|
+
headerTitle: config?.ui?.headerTitle ?? "Developer Portal",
|
|
19
|
+
pageTitle: config?.ui?.pageTitle ?? "%s | Dev Portal",
|
|
20
|
+
logo: config?.ui?.logo ?? "https://cdn.zuplo.com/www/favicon.png",
|
|
21
|
+
favicon:
|
|
22
|
+
config?.ui?.metadata?.favicon ??
|
|
23
|
+
"https://cdn.zuplo.com/www/favicon.png",
|
|
24
|
+
}}
|
|
25
|
+
navigation={config.navigation ?? []}
|
|
26
|
+
authentication={configuredAuthProvider}
|
|
27
|
+
plugins={[...configuredDocsPlugins, ...configuredApiPlugins]}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
|
3
|
+
import { XIcon } from "lucide-react"
|
|
4
|
+
import { cn } from "../util/cn.js";
|
|
5
|
+
|
|
6
|
+
const Dialog = DialogPrimitive.Root
|
|
7
|
+
|
|
8
|
+
const DialogTrigger = DialogPrimitive.Trigger
|
|
9
|
+
|
|
10
|
+
const DialogPortal = DialogPrimitive.Portal
|
|
11
|
+
|
|
12
|
+
const DialogClose = DialogPrimitive.Close
|
|
13
|
+
|
|
14
|
+
const DialogOverlay = React.forwardRef<
|
|
15
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
16
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
17
|
+
>(({ className, ...props }, ref) => (
|
|
18
|
+
<DialogPrimitive.Overlay
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(
|
|
21
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
))
|
|
27
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
|
28
|
+
|
|
29
|
+
const DialogContent = React.forwardRef<
|
|
30
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
31
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
32
|
+
>(({ className, children, ...props }, ref) => (
|
|
33
|
+
<DialogPortal>
|
|
34
|
+
<DialogOverlay />
|
|
35
|
+
<DialogPrimitive.Content
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={cn(
|
|
38
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
>
|
|
43
|
+
{children}
|
|
44
|
+
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
|
45
|
+
<XIcon className="h-4 w-4" />
|
|
46
|
+
<span className="sr-only">Close</span>
|
|
47
|
+
</DialogPrimitive.Close>
|
|
48
|
+
</DialogPrimitive.Content>
|
|
49
|
+
</DialogPortal>
|
|
50
|
+
))
|
|
51
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName
|
|
52
|
+
|
|
53
|
+
const DialogHeader = ({
|
|
54
|
+
className,
|
|
55
|
+
...props
|
|
56
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
57
|
+
<div
|
|
58
|
+
className={cn(
|
|
59
|
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
)
|
|
65
|
+
DialogHeader.displayName = "DialogHeader"
|
|
66
|
+
|
|
67
|
+
const DialogFooter = ({
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
71
|
+
<div
|
|
72
|
+
className={cn(
|
|
73
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
74
|
+
className
|
|
75
|
+
)}
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
)
|
|
79
|
+
DialogFooter.displayName = "DialogFooter"
|
|
80
|
+
|
|
81
|
+
const DialogTitle = React.forwardRef<
|
|
82
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
83
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
84
|
+
>(({ className, ...props }, ref) => (
|
|
85
|
+
<DialogPrimitive.Title
|
|
86
|
+
ref={ref}
|
|
87
|
+
className={cn(
|
|
88
|
+
"text-lg font-semibold leading-none tracking-tight",
|
|
89
|
+
className
|
|
90
|
+
)}
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
))
|
|
94
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
|
95
|
+
|
|
96
|
+
const DialogDescription = React.forwardRef<
|
|
97
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
98
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
99
|
+
>(({ className, ...props }, ref) => (
|
|
100
|
+
<DialogPrimitive.Description
|
|
101
|
+
ref={ref}
|
|
102
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
))
|
|
106
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
Dialog,
|
|
110
|
+
DialogPortal,
|
|
111
|
+
DialogOverlay,
|
|
112
|
+
DialogTrigger,
|
|
113
|
+
DialogClose,
|
|
114
|
+
DialogContent,
|
|
115
|
+
DialogHeader,
|
|
116
|
+
DialogFooter,
|
|
117
|
+
DialogTitle,
|
|
118
|
+
DialogDescription,
|
|
119
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../util/cn.js";
|
|
3
|
+
|
|
4
|
+
export interface InputProps
|
|
5
|
+
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
6
|
+
|
|
7
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
8
|
+
({ className, type, ...props }, ref) => {
|
|
9
|
+
return (
|
|
10
|
+
<input
|
|
11
|
+
type={type}
|
|
12
|
+
className={cn(
|
|
13
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
ref={ref}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
Input.displayName = "Input";
|
|
23
|
+
|
|
24
|
+
export { Input };
|
|
@@ -19,6 +19,8 @@ if (!import.meta.env.SSR) {
|
|
|
19
19
|
import("prismjs/components/prism-php.min.js");
|
|
20
20
|
// @ts-expect-error This is untyped
|
|
21
21
|
import("prismjs/components/prism-json.min.js");
|
|
22
|
+
// @ts-expect-error This is untyped
|
|
23
|
+
import("prismjs/components/prism-java.min.js");
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
import { useState } from "react";
|
package/src/app/main.tsx
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import App from "./
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
import App from "./App.js";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
// const { default: wdyr } = await import(
|
|
7
|
-
// "@welldone-software/why-did-you-render"
|
|
8
|
-
// );
|
|
9
|
-
//
|
|
10
|
-
// wdyr(React, {
|
|
11
|
-
// include: [/.*/],
|
|
12
|
-
// exclude: [/^BrowserRouter/, /^Link/, /^Route/],
|
|
13
|
-
// trackHooks: true,
|
|
14
|
-
// trackAllPureComponents: true,
|
|
15
|
-
// });
|
|
16
|
-
// }
|
|
17
|
-
|
|
18
|
-
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
5
|
+
createRoot(document.getElementById("root")!).render(
|
|
19
6
|
<React.StrictMode>
|
|
20
7
|
<App />
|
|
21
8
|
</React.StrictMode>,
|
|
@@ -3,34 +3,42 @@ import { useTheme } from "../../components/context/ThemeContext.js";
|
|
|
3
3
|
import { cn } from "../../util/cn.js";
|
|
4
4
|
import { pastellize } from "../../util/pastellize.js";
|
|
5
5
|
|
|
6
|
-
const DATA_ATTR = "data-linked-param";
|
|
6
|
+
export const DATA_ATTR = "data-linked-param";
|
|
7
|
+
|
|
8
|
+
export const usePastellizedColor = (name: string) => {
|
|
9
|
+
const [isDark] = useTheme();
|
|
10
|
+
return pastellize(
|
|
11
|
+
name,
|
|
12
|
+
!isDark ? { saturation: 100, lightness: 70 } : undefined,
|
|
13
|
+
);
|
|
14
|
+
};
|
|
7
15
|
|
|
8
16
|
export const ColorizedParam = ({
|
|
9
17
|
name,
|
|
18
|
+
value,
|
|
10
19
|
className,
|
|
11
20
|
backgroundOpacity = "100%",
|
|
12
21
|
slug,
|
|
13
22
|
children,
|
|
23
|
+
onClick,
|
|
14
24
|
}: {
|
|
15
25
|
name: string;
|
|
26
|
+
value?: string;
|
|
16
27
|
className?: string;
|
|
17
28
|
backgroundOpacity?: string;
|
|
18
29
|
slug?: string;
|
|
19
30
|
children?: ReactNode;
|
|
31
|
+
onClick?: () => void;
|
|
20
32
|
}) => {
|
|
21
33
|
const ref = useRef<HTMLSpanElement>(null);
|
|
22
|
-
const [isDark] = useTheme();
|
|
23
34
|
const normalized = name.replace("{", "").replace("}", "");
|
|
24
|
-
|
|
25
|
-
const color = pastellize(
|
|
26
|
-
normalized,
|
|
27
|
-
!isDark ? { saturation: 100, lightness: 70 } : undefined,
|
|
28
|
-
);
|
|
35
|
+
const color = usePastellizedColor(normalized);
|
|
29
36
|
|
|
30
37
|
const borderColor = `hsl(${color})`;
|
|
31
38
|
const backgroundColor = `hsl(${color} / ${backgroundOpacity})`;
|
|
32
39
|
|
|
33
40
|
useEffect(() => {
|
|
41
|
+
if (!slug) return;
|
|
34
42
|
if (!ref.current) return;
|
|
35
43
|
|
|
36
44
|
const onMouseEnter = () => {
|
|
@@ -62,12 +70,13 @@ export const ColorizedParam = ({
|
|
|
62
70
|
className={cn("inline-flex relative rounded group", className)}
|
|
63
71
|
{...{ [DATA_ATTR]: slug }}
|
|
64
72
|
ref={ref}
|
|
73
|
+
onClick={onClick}
|
|
65
74
|
>
|
|
66
75
|
<span
|
|
67
|
-
className="absolute inset-0 border-b-2
|
|
76
|
+
className="absolute inset-0 border-b-2 transition-opacity duration-200 opacity-30 group-data-[active=true]:opacity-100"
|
|
68
77
|
style={{ borderColor, backgroundColor }}
|
|
69
78
|
/>
|
|
70
|
-
<span className="relative">{children
|
|
79
|
+
<span className="relative">{children || name}</span>
|
|
71
80
|
</span>
|
|
72
81
|
);
|
|
73
82
|
};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { useApiIdentities } from "../../components/context/DevPortalProvider.js";
|
|
2
2
|
import type { OperationListItemResult } from "./OperationList.js";
|
|
3
|
+
import { Playground } from "./playground/Playground.js";
|
|
4
|
+
import { useOasConfig } from "./index.js";
|
|
5
|
+
import { gql, useQuery } from "urql";
|
|
6
|
+
|
|
7
|
+
const getServerQuery = gql`
|
|
8
|
+
query getServerQuery($input: JSON!, $type: SchemaType!) {
|
|
9
|
+
schema(input: $input, type: $type) {
|
|
10
|
+
url
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
3
14
|
|
|
4
15
|
export const MakeRequest = ({
|
|
5
16
|
operation,
|
|
@@ -7,9 +18,17 @@ export const MakeRequest = ({
|
|
|
7
18
|
operation: OperationListItemResult;
|
|
8
19
|
}) => {
|
|
9
20
|
const identities = useApiIdentities();
|
|
21
|
+
const variables = useOasConfig();
|
|
22
|
+
const [server] = useQuery({ query: getServerQuery, variables });
|
|
10
23
|
|
|
11
24
|
return (
|
|
12
25
|
<div>
|
|
26
|
+
<Playground
|
|
27
|
+
host={server.data?.schema.url}
|
|
28
|
+
method={operation.method}
|
|
29
|
+
url={operation.path}
|
|
30
|
+
defaultHeaders={[]}
|
|
31
|
+
/>
|
|
13
32
|
{identities.data.map((identity) => (
|
|
14
33
|
<button
|
|
15
34
|
key={identity.id}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type ResultOf } from "gql.tada";
|
|
2
1
|
import { Heading } from "../../Heading.js";
|
|
3
2
|
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
4
3
|
import { Markdown, ProseClasses } from "../../components/Markdown.js";
|
|
5
4
|
import { cn } from "../../util/cn.js";
|
|
6
5
|
import { OperationListItem } from "./OperationListItem.js";
|
|
7
|
-
import { graphql } from "./graphql/index.js";
|
|
8
6
|
import { useOasConfig } from "./index.js";
|
|
7
|
+
import { graphql } from "./graphql/index.js";
|
|
9
8
|
import { useQuery } from "./util/urql.js";
|
|
9
|
+
import { ResultOf } from "@graphql-typed-document-node/core";
|
|
10
10
|
|
|
11
|
-
export const OperationsFragment = graphql(`
|
|
11
|
+
export const OperationsFragment = graphql(/* GraphQL */ `
|
|
12
12
|
fragment OperationsFragment on OperationItem {
|
|
13
13
|
slug
|
|
14
14
|
summary
|
|
@@ -51,32 +51,30 @@ export const OperationsFragment = graphql(`
|
|
|
51
51
|
}
|
|
52
52
|
`);
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
export type OperationListItemResult = ResultOf<typeof OperationsFragment>;
|
|
55
|
+
|
|
56
|
+
const AllOperationsQuery = graphql(/* GraphQL */ `
|
|
57
|
+
query AllOperations($input: JSON!, $type: SchemaType!) {
|
|
58
|
+
schema(input: $input, type: $type) {
|
|
59
|
+
description
|
|
60
|
+
title
|
|
61
|
+
url
|
|
62
|
+
version
|
|
63
|
+
tags {
|
|
64
|
+
name
|
|
58
65
|
description
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
tags {
|
|
63
|
-
name
|
|
64
|
-
description
|
|
65
|
-
operations {
|
|
66
|
-
slug
|
|
67
|
-
...OperationsFragment
|
|
68
|
-
}
|
|
66
|
+
operations {
|
|
67
|
+
slug
|
|
68
|
+
...OperationsFragment
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
export type OperationListItemResult = ResultOf<typeof OperationsFragment>;
|
|
72
|
+
}
|
|
73
|
+
`);
|
|
77
74
|
|
|
78
75
|
export const OperationList = () => {
|
|
79
76
|
const { type, input } = useOasConfig();
|
|
77
|
+
|
|
80
78
|
const [result] = useQuery({
|
|
81
79
|
query: AllOperationsQuery,
|
|
82
80
|
variables: { type, input },
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { readFragment, type FragmentOf } from "gql.tada";
|
|
2
1
|
import { Heading } from "../../Heading.js";
|
|
3
2
|
import { Markdown, ProseClasses } from "../../components/Markdown.js";
|
|
4
3
|
import { groupBy } from "../../util/groupBy.js";
|
|
5
4
|
import { OperationsFragment } from "./OperationList.js";
|
|
6
5
|
import { ParameterList } from "./ParameterList.js";
|
|
7
6
|
import { Sidecar } from "./Sidecar.js";
|
|
7
|
+
import { FragmentType, useFragment } from "./graphql/index.js";
|
|
8
8
|
|
|
9
9
|
export const PARAM_GROUPS = ["path", "query", "header", "cookie"] as const;
|
|
10
10
|
export type ParameterGroup = (typeof PARAM_GROUPS)[number];
|
|
@@ -12,9 +12,9 @@ export type ParameterGroup = (typeof PARAM_GROUPS)[number];
|
|
|
12
12
|
export const OperationListItem = ({
|
|
13
13
|
operationFragment,
|
|
14
14
|
}: {
|
|
15
|
-
operationFragment:
|
|
15
|
+
operationFragment: FragmentType<typeof OperationsFragment>;
|
|
16
16
|
}) => {
|
|
17
|
-
const operation =
|
|
17
|
+
const operation = useFragment(OperationsFragment, operationFragment);
|
|
18
18
|
const groupedParameters = groupBy(operation?.parameters ?? [], "in");
|
|
19
19
|
|
|
20
20
|
return (
|