zudoku 0.1.1-dev.1 → 0.1.1-dev.11

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.
Files changed (163) hide show
  1. package/cli.js +2 -0
  2. package/dist/app/App.js +20 -0
  3. package/dist/app/App.js.map +1 -0
  4. package/dist/app/DevPortal.d.ts +0 -1
  5. package/dist/app/authentication/openid.js +2 -2
  6. package/dist/app/authentication/openid.js.map +1 -1
  7. package/dist/app/components/Dialog.d.ts +19 -0
  8. package/dist/app/components/Dialog.js +23 -0
  9. package/dist/app/components/Dialog.js.map +1 -0
  10. package/dist/app/components/Header.d.ts +0 -1
  11. package/dist/app/components/Input.d.ts +5 -0
  12. package/dist/app/components/Input.js +9 -0
  13. package/dist/app/components/Input.js.map +1 -0
  14. package/dist/app/components/SyntaxHighlight.js +2 -0
  15. package/dist/app/components/SyntaxHighlight.js.map +1 -1
  16. package/dist/app/components/context/DevPortalProvider.d.ts +0 -1
  17. package/dist/app/components/navigation/SideNavigationWrapper.d.ts +1 -2
  18. package/dist/app/components/navigation/useNavigationCollapsibleState.d.ts +0 -1
  19. package/dist/app/main.js +3 -15
  20. package/dist/app/main.js.map +1 -1
  21. package/dist/app/plugins/markdown/index.d.ts +0 -1
  22. package/dist/app/plugins/openapi/ColorizedParam.d.ts +5 -1
  23. package/dist/app/plugins/openapi/ColorizedParam.js +10 -5
  24. package/dist/app/plugins/openapi/ColorizedParam.js.map +1 -1
  25. package/dist/app/plugins/openapi/MakeRequest.js +18 -6
  26. package/dist/app/plugins/openapi/MakeRequest.js.map +1 -1
  27. package/dist/app/plugins/openapi/OperationList.d.ts +2 -45
  28. package/dist/app/plugins/openapi/OperationList.js +16 -16
  29. package/dist/app/plugins/openapi/OperationList.js.map +1 -1
  30. package/dist/app/plugins/openapi/OperationListItem.d.ts +2 -2
  31. package/dist/app/plugins/openapi/OperationListItem.js +2 -2
  32. package/dist/app/plugins/openapi/OperationListItem.js.map +1 -1
  33. package/dist/app/plugins/openapi/RequestBodySidecarBox.js +8 -8
  34. package/dist/app/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  35. package/dist/app/plugins/openapi/ResponsesSidecarBox.js +1 -1
  36. package/dist/app/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  37. package/dist/app/plugins/openapi/Sidecar.js +73 -18
  38. package/dist/app/plugins/openapi/Sidecar.js.map +1 -1
  39. package/dist/app/plugins/openapi/SidecarBox.d.ts +3 -5
  40. package/dist/app/plugins/openapi/SidecarBox.js +3 -5
  41. package/dist/app/plugins/openapi/SidecarBox.js.map +1 -1
  42. package/dist/app/plugins/openapi/graphql/fragment-masking.d.ts +19 -0
  43. package/dist/app/plugins/openapi/graphql/fragment-masking.js +16 -0
  44. package/dist/app/plugins/openapi/graphql/fragment-masking.js.map +1 -0
  45. package/dist/app/plugins/openapi/graphql/gql.d.ts +58 -0
  46. package/dist/app/plugins/openapi/graphql/gql.js +22 -0
  47. package/dist/app/plugins/openapi/graphql/gql.js.map +1 -0
  48. package/dist/app/plugins/openapi/graphql/graphql.d.ts +282 -0
  49. package/dist/app/plugins/openapi/graphql/graphql.js +526 -0
  50. package/dist/app/plugins/openapi/graphql/graphql.js.map +1 -0
  51. package/dist/app/plugins/openapi/graphql/index.d.ts +2 -836
  52. package/dist/app/plugins/openapi/graphql/index.js +2 -3
  53. package/dist/app/plugins/openapi/graphql/index.js.map +1 -1
  54. package/dist/app/plugins/openapi/index.d.ts +0 -1
  55. package/dist/app/plugins/openapi/playground/Playground.d.ts +8 -0
  56. package/dist/app/plugins/openapi/playground/Playground.js +98 -0
  57. package/dist/app/plugins/openapi/playground/Playground.js.map +1 -0
  58. package/dist/app/plugins/openapi/util/urql.d.ts +0 -1
  59. package/dist/app/ui/Button.d.ts +11 -0
  60. package/dist/app/ui/Button.js +34 -0
  61. package/dist/app/ui/Button.js.map +1 -0
  62. package/dist/app/ui/Card.js +1 -1
  63. package/dist/app/ui/Card.js.map +1 -1
  64. package/dist/app/ui/Tabs.d.ts +7 -0
  65. package/dist/app/ui/Tabs.js +13 -0
  66. package/dist/app/ui/Tabs.js.map +1 -0
  67. package/dist/app/util/MdxComponents.d.ts +2 -2
  68. package/dist/app/util/createVariantComponent.d.ts +15 -0
  69. package/dist/app/util/createVariantComponent.js +12 -0
  70. package/dist/app/util/createVariantComponent.js.map +1 -0
  71. package/dist/app/util/createWaitForNotify.d.ts +1 -1
  72. package/dist/app/util/slugify.d.ts +0 -1
  73. package/dist/cli/cmds/dev.js +0 -1
  74. package/dist/cli/cmds/dev.js.map +1 -1
  75. package/dist/cli/common/logger.d.ts +1 -2
  76. package/dist/cli/common/logger.js +2 -4
  77. package/dist/cli/common/logger.js.map +1 -1
  78. package/dist/cli/dev/handler.d.ts +1 -1
  79. package/dist/cli/dev/handler.js +11 -2
  80. package/dist/cli/dev/handler.js.map +1 -1
  81. package/dist/config/config.d.ts +11 -5
  82. package/dist/ts.d.ts +6 -0
  83. package/dist/ts.js +62 -0
  84. package/dist/ts.js.map +1 -0
  85. package/dist/vite/config.d.ts +1 -0
  86. package/dist/vite/config.js +80 -16
  87. package/dist/vite/config.js.map +1 -1
  88. package/dist/vite/config.test.d.ts +1 -0
  89. package/dist/vite/config.test.js +10 -0
  90. package/dist/vite/config.test.js.map +1 -0
  91. package/dist/vite/dev-server.js +3 -2
  92. package/dist/vite/dev-server.js.map +1 -1
  93. package/dist/vite/html.d.ts +1 -1
  94. package/dist/vite/html.js +2 -3
  95. package/dist/vite/html.js.map +1 -1
  96. package/dist/vite/plugin-api.d.ts +4 -0
  97. package/dist/vite/plugin-api.js +47 -0
  98. package/dist/vite/plugin-api.js.map +1 -0
  99. package/dist/vite/plugin-auth.d.ts +4 -0
  100. package/dist/vite/plugin-auth.js +29 -0
  101. package/dist/vite/plugin-auth.js.map +1 -0
  102. package/dist/vite/plugin-config.d.ts +6 -0
  103. package/dist/vite/plugin-config.js +24 -0
  104. package/dist/vite/plugin-config.js.map +1 -0
  105. package/dist/vite/plugin-docs.d.ts +4 -0
  106. package/dist/vite/plugin-docs.js +43 -0
  107. package/dist/vite/plugin-docs.js.map +1 -0
  108. package/dist/vite/plugin-docs.test.d.ts +1 -0
  109. package/dist/vite/plugin-docs.test.js +31 -0
  110. package/dist/vite/plugin-docs.test.js.map +1 -0
  111. package/dist/vite/plugin-html.d.ts +3 -0
  112. package/dist/vite/plugin-html.js +50 -0
  113. package/dist/vite/plugin-html.js.map +1 -0
  114. package/dist/vite/plugin-mdx.d.ts +8 -0
  115. package/dist/vite/plugin-mdx.js +61 -0
  116. package/dist/vite/plugin-mdx.js.map +1 -0
  117. package/dist/vite/plugin-metadata.d.ts +6 -0
  118. package/dist/vite/plugin-metadata.js +24 -0
  119. package/dist/vite/plugin-metadata.js.map +1 -0
  120. package/dist/vite/plugin.d.ts +2 -6
  121. package/dist/vite/plugin.js +14 -104
  122. package/dist/vite/plugin.js.map +1 -1
  123. package/package.json +32 -22
  124. package/src/app/App.tsx +30 -0
  125. package/src/app/components/Dialog.tsx +119 -0
  126. package/src/app/components/Input.tsx +24 -0
  127. package/src/app/components/SyntaxHighlight.tsx +2 -0
  128. package/src/app/main.tsx +3 -16
  129. package/src/app/plugins/openapi/ColorizedParam.tsx +18 -9
  130. package/src/app/plugins/openapi/MakeRequest.tsx +19 -0
  131. package/src/app/plugins/openapi/OperationList.tsx +20 -22
  132. package/src/app/plugins/openapi/OperationListItem.tsx +3 -3
  133. package/src/app/plugins/openapi/RequestBodySidecarBox.tsx +31 -28
  134. package/src/app/plugins/openapi/ResponsesSidecarBox.tsx +1 -1
  135. package/src/app/plugins/openapi/Sidecar.tsx +81 -20
  136. package/src/app/plugins/openapi/SidecarBox.tsx +30 -29
  137. package/src/app/plugins/openapi/graphql/fragment-masking.ts +111 -0
  138. package/src/app/plugins/openapi/graphql/gql.ts +70 -0
  139. package/src/app/plugins/openapi/graphql/graphql.ts +795 -0
  140. package/src/app/plugins/openapi/graphql/index.ts +2 -13
  141. package/src/app/plugins/openapi/playground/Playground.tsx +309 -0
  142. package/src/app/plugins/openapi/queries.graphql +6 -0
  143. package/src/app/ui/Button.tsx +56 -0
  144. package/src/app/ui/Card.tsx +1 -1
  145. package/src/app/ui/Tabs.tsx +52 -0
  146. package/src/app/util/createVariantComponent.tsx +30 -0
  147. package/dist/app/app.js +0 -69
  148. package/dist/app/app.js.map +0 -1
  149. package/dist/app/config.d.ts +0 -3
  150. package/dist/app/config.js +0 -9
  151. package/dist/app/config.js.map +0 -1
  152. package/dist/app/markdowns.d.ts +0 -3
  153. package/dist/app/markdowns.js +0 -5
  154. package/dist/app/markdowns.js.map +0 -1
  155. package/dist/app/plugins/openapi/util/getCode.d.ts +0 -2
  156. package/dist/app/plugins/openapi/util/getCode.js +0 -54
  157. package/dist/app/plugins/openapi/util/getCode.js.map +0 -1
  158. package/src/app/app.tsx +0 -85
  159. package/src/app/config.ts +0 -20
  160. package/src/app/markdowns.ts +0 -7
  161. package/src/app/plugins/openapi/graphql/env.d.ts +0 -48
  162. package/src/app/plugins/openapi/util/getCode.tsx +0 -69
  163. /package/dist/app/{app.d.ts → App.d.ts} +0 -0
@@ -1,13 +1,2 @@
1
- import { initGraphQLTada } from "gql.tada";
2
- import type { introspection } from "./env.d.ts";
3
-
4
- export const graphql = initGraphQLTada<{
5
- introspection: introspection;
6
- scalars: {
7
- JSON: unknown;
8
- JSONObject: unknown;
9
- };
10
- }>();
11
-
12
- export type { FragmentOf, ResultOf, VariablesOf } from "gql.tada";
13
- export { readFragment } from "gql.tada";
1
+ export * from "./fragment-masking.js";
2
+ export * from "./gql.js";
@@ -0,0 +1,309 @@
1
+ import {
2
+ Dialog,
3
+ DialogContent,
4
+ DialogDescription,
5
+ DialogHeader,
6
+ DialogTitle,
7
+ DialogTrigger,
8
+ } from "../../../components/Dialog.js";
9
+ import { Card, CardContent } from "../../../ui/Card.js";
10
+ import { Button } from "../../../ui/Button.js";
11
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../ui/Tabs.js";
12
+ import { Header } from "har-format";
13
+ import {
14
+ Fragment,
15
+ InputHTMLAttributes,
16
+ useEffect,
17
+ useRef,
18
+ useState,
19
+ } from "react";
20
+ import { TrashIcon } from "lucide-react";
21
+ import createVariantComponent from "../../../util/createVariantComponent.js";
22
+ import { SyntaxHighlight } from "../../../components/SyntaxHighlight.js";
23
+ import {
24
+ ColorizedParam,
25
+ DATA_ATTR,
26
+ usePastellizedColor,
27
+ } from "../ColorizedParam.js";
28
+ import { cn } from "../../../util/cn.js";
29
+ import { useMutation } from "@tanstack/react-query";
30
+
31
+ const InlineInput = createVariantComponent(
32
+ "input",
33
+ "px-2 bg-transparent h-8 font-mono text-xs m-2",
34
+ );
35
+
36
+ const ParameterValue = ({
37
+ part,
38
+ className,
39
+ ...props
40
+ }: {
41
+ part: string;
42
+ } & InputHTMLAttributes<HTMLInputElement>) => {
43
+ const color = usePastellizedColor(part);
44
+ return (
45
+ <InlineInput
46
+ {...props}
47
+ className={cn(className, "opacity-80 data-[active=true]:opacity-100")}
48
+ style={{ color: `hsl(${color})` }}
49
+ />
50
+ );
51
+ };
52
+
53
+ const Playground = ({
54
+ url,
55
+ host,
56
+ method,
57
+ defaultHeaders,
58
+ }: {
59
+ host: string;
60
+ url: string;
61
+ method: string;
62
+ defaultHeaders?: Header[];
63
+ }) => {
64
+ const [headers, setHeaders] = useState<Header[]>(
65
+ defaultHeaders ?? [{ name: "", value: "" }],
66
+ );
67
+ const [urlParts, setUrlParts] = useState<Header[]>(
68
+ url
69
+ .split("/")
70
+ .filter((part) => part.startsWith("{") && part.endsWith("}"))
71
+ .map((part) => ({ name: part, value: "" })),
72
+ );
73
+
74
+ useEffect(() => {
75
+ const lastHeader = headers.at(-1);
76
+ if (lastHeader?.value !== "" || lastHeader?.name !== "") {
77
+ setHeaders([...headers, { name: "", value: "" }]);
78
+ }
79
+ }, [headers]);
80
+
81
+ const x = useMutation({
82
+ mutationFn: async () => {
83
+ const fullUrl =
84
+ host +
85
+ url
86
+ .split("/")
87
+ .map((v) => urlParts.find((part) => part.name === v)?.value ?? v)
88
+ .join("/");
89
+ console.log(
90
+ fullUrl,
91
+ Object.fromEntries(
92
+ headers.map((header) => [header.name, header.value]),
93
+ ),
94
+ );
95
+ const response = await fetch(fullUrl, {
96
+ // method,
97
+ headers: Object.fromEntries(
98
+ headers
99
+ .filter((h) => h.name)
100
+ .map((header) => [header.name, header.value]),
101
+ ),
102
+ });
103
+
104
+ return {
105
+ status: response.status,
106
+ body: await response.text(),
107
+ };
108
+ },
109
+ });
110
+
111
+ const path = url.split("/").map((part) => (
112
+ <Fragment key={part}>
113
+ {part.startsWith("{") && part.endsWith("}") ? (
114
+ <ColorizedParam
115
+ name={part.slice(1, -1)}
116
+ backgroundOpacity="0"
117
+ onClick={() => {
118
+ console.log("asd");
119
+ }}
120
+ slug={part.slice(1, -1)}
121
+ >
122
+ {urlParts.find((p) => p.name === part)?.value}
123
+ </ColorizedParam>
124
+ ) : (
125
+ part
126
+ )}
127
+ /
128
+ <wbr />
129
+ </Fragment>
130
+ ));
131
+
132
+ return (
133
+ <Dialog>
134
+ <DialogTrigger>Open</DialogTrigger>
135
+ <DialogContent className="max-w-screen-xl">
136
+ <DialogHeader>
137
+ <DialogTitle>API Playground</DialogTitle>
138
+ <DialogDescription>
139
+ <div className="grid grid-cols-2 gap-2">
140
+ <Card>
141
+ <CardContent className="border-b border-border pt-4">
142
+ <div>URL</div>
143
+ <div className="flex gap-2">
144
+ <div className="border rounded border-border p-1.5 w-full">
145
+ {path}
146
+ </div>
147
+ <Button onClick={() => x.mutateAsync()}>Send</Button>
148
+ </div>
149
+ </CardContent>
150
+ <Tabs defaultValue="headers">
151
+ <CardContent className="border-b border-border py-4">
152
+ <TabsList>
153
+ <TabsTrigger value="headers">
154
+ Headers ({headers.length})
155
+ </TabsTrigger>
156
+ <TabsTrigger value="parameters">Parameters</TabsTrigger>
157
+ <TabsTrigger value="auth">Auth</TabsTrigger>
158
+ </TabsList>
159
+ </CardContent>
160
+ <CardContent>
161
+ <TabsContent value="headers">
162
+ <div className="grid grid-cols-[1fr_1fr_auto]">
163
+ {headers.map((header, i) => (
164
+ <div
165
+ key={i}
166
+ className="grid-cols-subgrid col-span-full grid items-center gap-x-2 has-[:focus]:bg-muted hover:bg-muted rounded overflow-hidden group"
167
+ >
168
+ {/*<input type="checkbox" />*/}
169
+ <InlineInput
170
+ onChange={(e) =>
171
+ setHeaders((headers) => {
172
+ const newHeaders = [...headers];
173
+ newHeaders[i] = {
174
+ ...headers[i],
175
+ name: e.target.value,
176
+ };
177
+ return newHeaders;
178
+ })
179
+ }
180
+ value={header.name}
181
+ placeholder={"Name"}
182
+ className="peer"
183
+ />
184
+ <InlineInput
185
+ onChange={(e) =>
186
+ setHeaders((headers) => {
187
+ const newHeaders = [...headers];
188
+ newHeaders[i] = {
189
+ name: "",
190
+ ...headers.at(i),
191
+ value: e.target.value,
192
+ };
193
+ return newHeaders;
194
+ })
195
+ }
196
+ value={header.value}
197
+ placeholder={"Value"}
198
+ className="peer"
199
+ />
200
+ <button
201
+ className="hover:bg-black/5 p-1 rounded mr-2 text-muted-foreground invisible group-hover:visible peer-focus:visible"
202
+ onClick={() => {
203
+ setHeaders((headers) =>
204
+ [...headers].toSpliced(i, 1),
205
+ );
206
+ }}
207
+ >
208
+ <TrashIcon size={16} />
209
+ </button>
210
+ <div className="col-span-full border-b border-border"></div>
211
+ </div>
212
+ ))}
213
+ </div>
214
+ </TabsContent>
215
+ <TabsContent value="parameters">
216
+ Parameters
217
+ <div className="grid grid-cols-[1fr_1fr_auto]">
218
+ {urlParts.map(({ name, value }, i) => (
219
+ <div
220
+ key={i}
221
+ className="grid-cols-subgrid col-span-full grid items-center gap-x-2 has-[:focus]:bg-muted hover:bg-muted rounded overflow-hidden group"
222
+ >
223
+ {/*<input type="checkbox" />*/}
224
+ <InlineInput
225
+ onChange={(e) =>
226
+ setHeaders((headers) => {
227
+ const newHeaders = [...headers];
228
+ newHeaders[i] = {
229
+ ...headers[i],
230
+ name: e.target.value,
231
+ };
232
+ return newHeaders;
233
+ })
234
+ }
235
+ value={name.slice(1, -1)}
236
+ disabled
237
+ placeholder={"Name"}
238
+ className="peer"
239
+ />
240
+ <ParameterValue
241
+ part={name.slice(1, -1)}
242
+ onChange={(e) =>
243
+ setUrlParts((parts) => {
244
+ const newParts = [...parts];
245
+ newParts[i] = {
246
+ name: "",
247
+ ...parts.at(i),
248
+ value: e.target.value,
249
+ };
250
+ return newParts;
251
+ })
252
+ }
253
+ {...{ [DATA_ATTR]: name.slice(1, -1) }}
254
+ value={value}
255
+ placeholder={"Value"}
256
+ className="peer"
257
+ />
258
+
259
+ <div className="col-span-full border-b border-border"></div>
260
+ </div>
261
+ ))}
262
+ </div>
263
+ </TabsContent>
264
+ <TabsContent value="auth">
265
+ <CardContent>
266
+ {url
267
+ .split("/")
268
+ .map((part, i) =>
269
+ part.startsWith("{") && part.endsWith("}")
270
+ ? urlParts[i]
271
+ : part,
272
+ )
273
+ .join("/")}
274
+ </CardContent>
275
+ Change your password here.
276
+ </TabsContent>
277
+ </CardContent>
278
+ </Tabs>
279
+ </Card>
280
+ <Card>
281
+ <CardContent>
282
+ {method.toUpperCase()}
283
+ {url
284
+ .split("/")
285
+ .map((v) =>
286
+ v.startsWith("{") && v.endsWith("}")
287
+ ? urlParts.find((part) => part.name === v)?.value ?? v
288
+ : v,
289
+ )
290
+ .join("/")}
291
+ <SyntaxHighlight
292
+ language="json"
293
+ noBackground
294
+ copyable={false}
295
+ className="text-xs"
296
+ code={x.data?.body ?? JSON.stringify("")}
297
+ />
298
+ </CardContent>
299
+ {x.data?.status}
300
+ </Card>
301
+ </div>
302
+ </DialogDescription>
303
+ </DialogHeader>
304
+ </DialogContent>
305
+ </Dialog>
306
+ );
307
+ };
308
+
309
+ export { Playground };
@@ -0,0 +1,6 @@
1
+ query getServerUrl($userId: ID!) {
2
+ schema(input: {userId: $userId}) {
3
+ serverUrl
4
+ }
5
+ }
6
+
@@ -0,0 +1,56 @@
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+ import { cn } from "../util/cn.js";
5
+
6
+ const buttonVariants = cva(
7
+ "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",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default:
12
+ "bg-primary text-primary-foreground shadow hover:bg-primary/90",
13
+ destructive:
14
+ "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
15
+ outline:
16
+ "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
17
+ secondary:
18
+ "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
19
+ ghost: "hover:bg-accent hover:text-accent-foreground",
20
+ link: "text-primary underline-offset-4 hover:underline",
21
+ },
22
+ size: {
23
+ default: "h-9 px-4 py-2",
24
+ sm: "h-8 rounded-md px-3 text-xs",
25
+ lg: "h-10 rounded-md px-8",
26
+ icon: "h-9 w-9",
27
+ },
28
+ },
29
+ defaultVariants: {
30
+ variant: "default",
31
+ size: "default",
32
+ },
33
+ }
34
+ )
35
+
36
+ export interface ButtonProps
37
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
38
+ VariantProps<typeof buttonVariants> {
39
+ asChild?: boolean
40
+ }
41
+
42
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
43
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
44
+ const Comp = asChild ? Slot : "button"
45
+ return (
46
+ <Comp
47
+ className={cn(buttonVariants({ variant, size, className }))}
48
+ ref={ref}
49
+ {...props}
50
+ />
51
+ )
52
+ }
53
+ )
54
+ Button.displayName = "Button"
55
+
56
+ export { Button, buttonVariants }
@@ -8,7 +8,7 @@ const Card = React.forwardRef<
8
8
  <div
9
9
  ref={ref}
10
10
  className={cn(
11
- "rounded-xl border bg-card text-card-foreground shadow",
11
+ "rounded-xl border border-border bg-card text-card-foreground shadow",
12
12
  className,
13
13
  )}
14
14
  {...props}
@@ -0,0 +1,52 @@
1
+ import * as React from "react";
2
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
3
+ import { cn } from "../util/cn.js";
4
+
5
+ const Tabs = TabsPrimitive.Root;
6
+
7
+ const TabsList = React.forwardRef<
8
+ React.ElementRef<typeof TabsPrimitive.List>,
9
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
10
+ >(({ className, ...props }, ref) => (
11
+ <TabsPrimitive.List
12
+ ref={ref}
13
+ className={cn(
14
+ "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
15
+ className,
16
+ )}
17
+ {...props}
18
+ />
19
+ ));
20
+ TabsList.displayName = TabsPrimitive.List.displayName;
21
+
22
+ const TabsTrigger = React.forwardRef<
23
+ React.ElementRef<typeof TabsPrimitive.Trigger>,
24
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
25
+ >(({ className, ...props }, ref) => (
26
+ <TabsPrimitive.Trigger
27
+ ref={ref}
28
+ className={cn(
29
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
30
+ className,
31
+ )}
32
+ {...props}
33
+ />
34
+ ));
35
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
36
+
37
+ const TabsContent = React.forwardRef<
38
+ React.ElementRef<typeof TabsPrimitive.Content>,
39
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
40
+ >(({ className, ...props }, ref) => (
41
+ <TabsPrimitive.Content
42
+ ref={ref}
43
+ className={cn(
44
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
45
+ className,
46
+ )}
47
+ {...props}
48
+ />
49
+ ));
50
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
51
+
52
+ export { Tabs, TabsList, TabsTrigger, TabsContent };
@@ -0,0 +1,30 @@
1
+ import { cva } from "class-variance-authority";
2
+ import { ClassValue } from "clsx";
3
+ import * as React from "react";
4
+ import { JSX } from "react/jsx-runtime";
5
+ import { cn } from "./cn.js";
6
+
7
+ const createVariantComponent = <
8
+ E extends keyof React.ReactHTML,
9
+ C extends ReturnType<typeof cva>,
10
+ >(
11
+ tag: E,
12
+ cvx: ClassValue | C,
13
+ // variantProps: Array<keyof VariantProps<C>> = [],
14
+ ) => {
15
+ const MyVariant = ({
16
+ className,
17
+ ...props
18
+ }: JSX.IntrinsicElements[E] & { className?: ClassValue }) =>
19
+ React.createElement(tag, {
20
+ ...props,
21
+ className:
22
+ typeof cvx === "function" ? cvx({ className }) : cn(cvx, className),
23
+ });
24
+
25
+ MyVariant.displayName = `VariantComponent(${tag})`;
26
+
27
+ return MyVariant;
28
+ };
29
+
30
+ export default createVariantComponent;
package/dist/app/app.js DELETED
@@ -1,69 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import "./main.css";
3
- import DevPortal from "./DevPortal.js";
4
- import { markdownPlugin } from "./plugins/markdown/index.js";
5
- import { openApiPlugin } from "./plugins/openapi/index.js";
6
- import config from "./config.js";
7
- // async function getAuthProvider(authConfig: AuthenticationConfig) {
8
- // if (authConfig.type === "clerk") {
9
- // const clerkProvider = await import("./authentication/clerk.js");
10
- // return clerkProvider(authConfig);
11
- // } else {
12
- // throw new Error(
13
- // `The authentication type "${authConfig.type}" is not supported.`,
14
- // );
15
- // }
16
- // //openIdAuth({
17
- // // clientId: oauth.client_id,
18
- // // authorizationEndpoint: oauth.authorize_url,
19
- // // tokenEndpoint: oauth.token_fetch_url,
20
- // // })
21
- // }
22
- export default function App() {
23
- return (_jsx(DevPortal, { meta: {
24
- headerTitle: config?.ui?.headerTitle ?? "Developer Portal",
25
- pageTitle: config?.ui?.pageTitle ?? "%s | Dev Portal",
26
- logo: config?.ui?.logo ?? "https://cdn.zuplo.com/www/favicon.png",
27
- favicon: config?.ui?.metadata?.favicon ??
28
- "https://cdn.zuplo.com/www/favicon.png",
29
- }, navigation: config.navigation ?? [],
30
- // authentication={
31
- // config.authentication
32
- // ? getAuthProvider(config.authentication)
33
- // : undefined
34
- // }
35
- plugins: [
36
- ...(config.docs
37
- ? Array.isArray(config.docs)
38
- ? config.docs
39
- : [config.docs]
40
- : []).map((docs) => markdownPlugin({
41
- markdownFiles: docs?.files ?? {},
42
- })),
43
- ...(config.apis
44
- ? Array.isArray(config.apis)
45
- ? config.apis
46
- : [config.apis]
47
- : []).map((api) => openApiPlugin(api)),
48
- // apiKeyPlugin({
49
- // // consumerEndpoint:
50
- // // "https://zudoku-customer-main-b36fa2f.d2.zuplo.dev/v1/developer/api-keys",
51
- // getConsumers: async (ctx) => {
52
- // const accessToken = await ctx.authentication?.getToken?.(ctx);
53
- // if (!accessToken) {
54
- // return;
55
- // }
56
- // const consumers = await fetch(
57
- // "https://zudoku-customer-main-b36fa2f.d2.zuplo.dev/v1/developer/api-keys",
58
- // {
59
- // headers: {
60
- // Authorization: `Bearer ${accessToken}`,
61
- // },
62
- // },
63
- // );
64
- // return { consumers: [await consumers.json()] };
65
- // },
66
- // }),
67
- ] }));
68
- }
69
- //# sourceMappingURL=app.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/app/app.tsx"],"names":[],"mappings":";AAAA,OAAO,YAAY,CAAC;AAEpB,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,qEAAqE;AACrE,uCAAuC;AACvC,uEAAuE;AACvE,wCAAwC;AACxC,aAAa;AACb,uBAAuB;AACvB,0EAA0E;AAC1E,SAAS;AACT,MAAM;AACN,mBAAmB;AACnB,oCAAoC;AACpC,qDAAqD;AACrD,+CAA+C;AAC/C,UAAU;AACV,IAAI;AAEJ,MAAM,CAAC,OAAO,UAAU,GAAG;IACzB,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAE;YACJ,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,IAAI,kBAAkB;YAC1D,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,IAAI,iBAAiB;YACrD,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,IAAI,uCAAuC;YACjE,OAAO,EACL,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO;gBAC7B,uCAAuC;SAC1C,EACD,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,EAAE;QACnC,mBAAmB;QACnB,0BAA0B;QAC1B,+CAA+C;QAC/C,kBAAkB;QAClB,IAAI;QACJ,OAAO,EAAE;YACP,GAAG,CAAC,MAAM,CAAC,IAAI;gBACb,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;oBAC1B,CAAC,CAAC,MAAM,CAAC,IAAI;oBACb,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;gBACjB,CAAC,CAAC,EAAE,CACL,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACb,cAAc,CAAC;gBACb,aAAa,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE;aACjC,CAAC,CACH;YACD,GAAG,CAAC,MAAM,CAAC,IAAI;gBACb,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;oBAC1B,CAAC,CAAC,MAAM,CAAC,IAAI;oBACb,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;gBACjB,CAAC,CAAC,EAAE,CACL,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;YAElC,iBAAiB;YACjB,yBAAyB;YACzB,oFAAoF;YACpF,mCAAmC;YACnC,qEAAqE;YAErE,0BAA0B;YAC1B,gBAAgB;YAChB,QAAQ;YAER,qCAAqC;YACrC,mFAAmF;YACnF,UAAU;YACV,qBAAqB;YACrB,oDAAoD;YACpD,aAAa;YACb,WAAW;YACX,SAAS;YAET,sDAAsD;YACtD,OAAO;YACP,MAAM;SACP,GACD,CACH,CAAC;AACJ,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { ZudokuConfig } from "../config/config.js";
2
- declare let config: ZudokuConfig;
3
- export default config;
@@ -1,9 +0,0 @@
1
- // Search for config files
2
- const configs = import.meta.glob("/zudoku.config.{js,jsx,ts,tsx,mjs}", { eager: true });
3
- let config = {};
4
- // If we found any, load the first one
5
- if (Object.keys(configs).length > 0) {
6
- config = configs[Object.keys(configs)[0]].default;
7
- }
8
- export default config;
9
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/app/config.ts"],"names":[],"mappings":"AAMA,0BAA0B;AAC1B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAC9B,oCAAoC,EACpC,EAAE,KAAK,EAAE,IAAI,EAAE,CAChB,CAAC;AAEF,IAAI,MAAM,GAAiB,EAAE,CAAC;AAE9B,sCAAsC;AACtC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACpC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACpD,CAAC;AAED,eAAe,MAAM,CAAC"}
@@ -1,3 +0,0 @@
1
- import { MDXImport } from "./plugins/markdown/index.js";
2
- declare const markdowns: Record<string, () => Promise<MDXImport>>;
3
- export default markdowns;
@@ -1,5 +0,0 @@
1
- const markdowns = import.meta.glob("/pages/**/*.mdx", {
2
- eager: false,
3
- });
4
- export default markdowns;
5
- //# sourceMappingURL=markdowns.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markdowns.js","sourceRoot":"","sources":["../../src/app/markdowns.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAY,iBAAiB,EAAE;IAC/D,KAAK,EAAE,KAAK;CACb,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { OperationListItemResult } from "../OperationList.js";
2
- export declare const getCode: (operation: OperationListItemResult, option: string) => string;
@@ -1,54 +0,0 @@
1
- export const getCode = (operation, option) => {
2
- switch (option) {
3
- case "curl":
4
- return (`curl --request ${operation.method.toLocaleUpperCase()} \\\n` +
5
- ` --url ${operation.path} \\\n` +
6
- ` --header 'Content-Type: application/json'`);
7
- case "wget":
8
- return (`wget --method=${operation.method.toLocaleUpperCase()} \\\n` +
9
- ` --header='Content-Type: application/json' \\\n` +
10
- ` ${operation.path}`);
11
- case "js":
12
- return (`fetch('${operation.path}', {\n` +
13
- ` method: '${operation.method.toLocaleUpperCase()}',\n` +
14
- ` headers: { 'Content-Type': 'application/json' },\n` +
15
- `});`);
16
- case "ruby":
17
- return (`require 'net/http'\n\n` +
18
- `url = URI.parse('${operation.path}')\n` +
19
- `http = Net::HTTP.new(url.host, url.port)\n` +
20
- `request = Net::HTTP::${operation.method}.new(url)\n` +
21
- `request['Content-Type'] = 'application/json'\n` +
22
- `http.request(request)`);
23
- case "php":
24
- return (`$ch = curl_init('${operation.path}');\n` +
25
- `curl_setopt($ch, CURLOPT_CUSTOMREQUEST, '${operation.method.toLocaleUpperCase()}');\n` +
26
- `curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);\n` +
27
- `curl_exec($ch);\n` +
28
- `curl_close($ch);`);
29
- case "go":
30
- return (`package main\n\n` +
31
- `import (\n` +
32
- ` "net/http"\n` +
33
- ` "strings"\n` +
34
- `)\n\n` +
35
- `func main() {\n` +
36
- ` client := &http.Client{}\n` +
37
- ` req, _ := http.NewRequest("${operation.method.toLocaleUpperCase()}", "${operation.path}", strings.NewReader(""))\n` +
38
- ` req.Header.Set("Content-Type", "application/json")\n` +
39
- ` client.Do(req)\n` +
40
- `}`);
41
- case "rust":
42
- return (`use reqwest::Client;\n\n` +
43
- `fn main() {\n` +
44
- ` let client = Client::new();\n` +
45
- ` let res = client\n` +
46
- ` .${operation.method.toLocaleLowerCase()}("${operation.path}")\n` +
47
- ` .header("Content-Type", "application/json")\n` +
48
- ` .send();\n` +
49
- `}`);
50
- default:
51
- return "";
52
- }
53
- };
54
- //# sourceMappingURL=getCode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCode.js","sourceRoot":"","sources":["../../../../../src/app/plugins/openapi/util/getCode.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,SAAkC,EAAE,MAAc,EAAE,EAAE;IAC5E,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,CACL,kBAAkB,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO;gBAC7D,WAAW,SAAS,CAAC,IAAI,OAAO;gBAChC,6CAA6C,CAC9C,CAAC;QACJ,KAAK,MAAM;YACT,OAAO,CACL,iBAAiB,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO;gBAC5D,kDAAkD;gBAClD,KAAK,SAAS,CAAC,IAAI,EAAE,CACtB,CAAC;QACJ,KAAK,IAAI;YACP,OAAO,CACL,UAAU,SAAS,CAAC,IAAI,QAAQ;gBAChC,cAAc,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM;gBACxD,sDAAsD;gBACtD,KAAK,CACN,CAAC;QACJ,KAAK,MAAM;YACT,OAAO,CACL,wBAAwB;gBACxB,oBAAoB,SAAS,CAAC,IAAI,MAAM;gBACxC,4CAA4C;gBAC5C,wBAAwB,SAAS,CAAC,MAAM,aAAa;gBACrD,gDAAgD;gBAChD,uBAAuB,CACxB,CAAC;QACJ,KAAK,KAAK;YACR,OAAO,CACL,oBAAoB,SAAS,CAAC,IAAI,OAAO;gBACzC,4CAA4C,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO;gBACvF,6EAA6E;gBAC7E,mBAAmB;gBACnB,kBAAkB,CACnB,CAAC;QACJ,KAAK,IAAI;YACP,OAAO,CACL,kBAAkB;gBAClB,YAAY;gBACZ,gBAAgB;gBAChB,eAAe;gBACf,OAAO;gBACP,iBAAiB;gBACjB,8BAA8B;gBAC9B,gCAAgC,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,OAAO,SAAS,CAAC,IAAI,6BAA6B;gBACtH,wDAAwD;gBACxD,oBAAoB;gBACpB,GAAG,CACJ,CAAC;QACJ,KAAK,MAAM;YACT,OAAO,CACL,0BAA0B;gBAC1B,eAAe;gBACf,iCAAiC;gBACjC,sBAAsB;gBACtB,QAAQ,SAAS,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,SAAS,CAAC,IAAI,MAAM;gBACrE,mDAAmD;gBACnD,gBAAgB;gBAChB,GAAG,CACJ,CAAC;QACJ;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC,CAAC"}