zudoku 0.1.1-dev.2 → 0.1.1-dev.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.
Files changed (108) hide show
  1. package/cli.js +2 -0
  2. package/dist/app/{app.js → App.js} +2 -21
  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 +1 -1
  20. package/dist/app/plugins/markdown/index.d.ts +0 -1
  21. package/dist/app/plugins/openapi/ColorizedParam.d.ts +5 -1
  22. package/dist/app/plugins/openapi/ColorizedParam.js +10 -5
  23. package/dist/app/plugins/openapi/ColorizedParam.js.map +1 -1
  24. package/dist/app/plugins/openapi/MakeRequest.js +18 -6
  25. package/dist/app/plugins/openapi/MakeRequest.js.map +1 -1
  26. package/dist/app/plugins/openapi/OperationList.d.ts +2 -45
  27. package/dist/app/plugins/openapi/OperationList.js +16 -16
  28. package/dist/app/plugins/openapi/OperationList.js.map +1 -1
  29. package/dist/app/plugins/openapi/OperationListItem.d.ts +2 -2
  30. package/dist/app/plugins/openapi/OperationListItem.js +2 -2
  31. package/dist/app/plugins/openapi/OperationListItem.js.map +1 -1
  32. package/dist/app/plugins/openapi/RequestBodySidecarBox.js +8 -8
  33. package/dist/app/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  34. package/dist/app/plugins/openapi/ResponsesSidecarBox.js +1 -1
  35. package/dist/app/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  36. package/dist/app/plugins/openapi/Sidecar.js +73 -18
  37. package/dist/app/plugins/openapi/Sidecar.js.map +1 -1
  38. package/dist/app/plugins/openapi/SidecarBox.d.ts +3 -5
  39. package/dist/app/plugins/openapi/SidecarBox.js +3 -5
  40. package/dist/app/plugins/openapi/SidecarBox.js.map +1 -1
  41. package/dist/app/plugins/openapi/graphql/fragment-masking.d.ts +19 -0
  42. package/dist/app/plugins/openapi/graphql/fragment-masking.js +16 -0
  43. package/dist/app/plugins/openapi/graphql/fragment-masking.js.map +1 -0
  44. package/dist/app/plugins/openapi/graphql/gql.d.ts +58 -0
  45. package/dist/app/plugins/openapi/graphql/gql.js +22 -0
  46. package/dist/app/plugins/openapi/graphql/gql.js.map +1 -0
  47. package/dist/app/plugins/openapi/graphql/graphql.d.ts +282 -0
  48. package/dist/app/plugins/openapi/graphql/graphql.js +526 -0
  49. package/dist/app/plugins/openapi/graphql/graphql.js.map +1 -0
  50. package/dist/app/plugins/openapi/graphql/index.d.ts +2 -836
  51. package/dist/app/plugins/openapi/graphql/index.js +2 -3
  52. package/dist/app/plugins/openapi/graphql/index.js.map +1 -1
  53. package/dist/app/plugins/openapi/index.d.ts +0 -1
  54. package/dist/app/plugins/openapi/playground/Playground.d.ts +8 -0
  55. package/dist/app/plugins/openapi/playground/Playground.js +98 -0
  56. package/dist/app/plugins/openapi/playground/Playground.js.map +1 -0
  57. package/dist/app/plugins/openapi/util/urql.d.ts +0 -1
  58. package/dist/app/ui/Button.d.ts +11 -0
  59. package/dist/app/ui/Button.js +34 -0
  60. package/dist/app/ui/Button.js.map +1 -0
  61. package/dist/app/ui/Card.js +1 -1
  62. package/dist/app/ui/Card.js.map +1 -1
  63. package/dist/app/ui/Tabs.d.ts +7 -0
  64. package/dist/app/ui/Tabs.js +13 -0
  65. package/dist/app/ui/Tabs.js.map +1 -0
  66. package/dist/app/util/MdxComponents.d.ts +2 -2
  67. package/dist/app/util/createVariantComponent.d.ts +15 -0
  68. package/dist/app/util/createVariantComponent.js +12 -0
  69. package/dist/app/util/createVariantComponent.js.map +1 -0
  70. package/dist/app/util/createWaitForNotify.d.ts +1 -1
  71. package/dist/app/util/slugify.d.ts +0 -1
  72. package/dist/vite/config.d.ts +1 -0
  73. package/dist/vite/config.js +45 -10
  74. package/dist/vite/config.js.map +1 -1
  75. package/dist/vite/config.test.d.ts +1 -0
  76. package/dist/vite/config.test.js +9 -0
  77. package/dist/vite/config.test.js.map +1 -0
  78. package/package.json +15 -5
  79. package/src/app/{app.tsx → App.tsx} +1 -23
  80. package/src/app/components/Dialog.tsx +119 -0
  81. package/src/app/components/Input.tsx +24 -0
  82. package/src/app/components/SyntaxHighlight.tsx +2 -0
  83. package/src/app/main.tsx +1 -1
  84. package/src/app/plugins/openapi/ColorizedParam.tsx +18 -9
  85. package/src/app/plugins/openapi/MakeRequest.tsx +19 -0
  86. package/src/app/plugins/openapi/OperationList.tsx +20 -22
  87. package/src/app/plugins/openapi/OperationListItem.tsx +3 -3
  88. package/src/app/plugins/openapi/RequestBodySidecarBox.tsx +31 -28
  89. package/src/app/plugins/openapi/ResponsesSidecarBox.tsx +1 -1
  90. package/src/app/plugins/openapi/Sidecar.tsx +81 -20
  91. package/src/app/plugins/openapi/SidecarBox.tsx +30 -29
  92. package/src/app/plugins/openapi/graphql/fragment-masking.ts +111 -0
  93. package/src/app/plugins/openapi/graphql/gql.ts +70 -0
  94. package/src/app/plugins/openapi/graphql/graphql.ts +795 -0
  95. package/src/app/plugins/openapi/graphql/index.ts +2 -13
  96. package/src/app/plugins/openapi/playground/Playground.tsx +309 -0
  97. package/src/app/plugins/openapi/queries.graphql +6 -0
  98. package/src/app/ui/Button.tsx +56 -0
  99. package/src/app/ui/Card.tsx +1 -1
  100. package/src/app/ui/Tabs.tsx +52 -0
  101. package/src/app/util/createVariantComponent.tsx +30 -0
  102. package/dist/app/app.js.map +0 -1
  103. package/dist/app/plugins/openapi/util/getCode.d.ts +0 -2
  104. package/dist/app/plugins/openapi/util/getCode.js +0 -54
  105. package/dist/app/plugins/openapi/util/getCode.js.map +0 -1
  106. package/src/app/plugins/openapi/graphql/env.d.ts +0 -48
  107. package/src/app/plugins/openapi/util/getCode.tsx +0 -69
  108. /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;
@@ -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,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"}
@@ -1,48 +0,0 @@
1
- /* eslint-disable */
2
- /* prettier-ignore */
3
-
4
- /** An IntrospectionQuery representation of your schema.
5
- *
6
- * @remarks
7
- * This is an introspection of your schema saved as a file by GraphQLSP.
8
- * It will automatically be used by `gql.tada` to infer the types of your GraphQL documents.
9
- * If you need to reuse this data or update your `scalars`, update `tadaOutputLocation` to
10
- * instead save to a .ts instead of a .d.ts file.
11
- */
12
- export type introspection = {
13
- name: never;
14
- query: 'Query';
15
- mutation: never;
16
- subscription: never;
17
- types: {
18
- 'Boolean': unknown;
19
- 'EncodingItem': { kind: 'OBJECT'; name: 'EncodingItem'; fields: { 'allowReserved': { name: 'allowReserved'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'contentType': { name: 'contentType'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'explode': { name: 'explode'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'headers': { name: 'headers'; type: { kind: 'SCALAR'; name: 'JSONObject'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'style': { name: 'style'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; };
20
- 'ExampleItem': { kind: 'OBJECT'; name: 'ExampleItem'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'externalValue': { name: 'externalValue'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'summary': { name: 'summary'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'value': { name: 'value'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; };
21
- 'Float': unknown;
22
- 'ID': unknown;
23
- 'Int': unknown;
24
- 'JSON': unknown;
25
- 'JSONObject': unknown;
26
- 'MediaTypeObject': { kind: 'OBJECT'; name: 'MediaTypeObject'; fields: { 'encoding': { name: 'encoding'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'EncodingItem'; ofType: null; }; }; } }; 'examples': { name: 'examples'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ExampleItem'; ofType: null; }; }; } }; 'mediaType': { name: 'mediaType'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'schema': { name: 'schema'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'JSON'; ofType: null; }; } }; }; };
27
- 'OperationItem': { kind: 'OBJECT'; name: 'OperationItem'; fields: { 'contentTypes': { name: 'contentTypes'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; } }; 'deprecated': { name: 'deprecated'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'method': { name: 'method'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'operationId': { name: 'operationId'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'parameters': { name: 'parameters'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ParameterItem'; ofType: null; }; }; } }; 'path': { name: 'path'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'requestBody': { name: 'requestBody'; type: { kind: 'OBJECT'; name: 'RequestBodyObject'; ofType: null; } }; 'responses': { name: 'responses'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ResponseItem'; ofType: null; }; }; }; } }; 'slug': { name: 'slug'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'summary': { name: 'summary'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'tags': { name: 'tags'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'TagItem'; ofType: null; }; }; } }; }; };
28
- 'ParameterIn': { name: 'ParameterIn'; enumValues: 'cookie' | 'header' | 'path' | 'query'; };
29
- 'ParameterItem': { kind: 'OBJECT'; name: 'ParameterItem'; fields: { 'allowEmptyValue': { name: 'allowEmptyValue'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'allowReserved': { name: 'allowReserved'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'deprecated': { name: 'deprecated'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'examples': { name: 'examples'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'ExampleItem'; ofType: null; }; }; } }; 'explode': { name: 'explode'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'in': { name: 'in'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'ENUM'; name: 'ParameterIn'; ofType: null; }; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'required': { name: 'required'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; 'schema': { name: 'schema'; type: { kind: 'SCALAR'; name: 'JSON'; ofType: null; } }; 'style': { name: 'style'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; }; };
30
- 'PathItem': { kind: 'OBJECT'; name: 'PathItem'; fields: { 'methods': { name: 'methods'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; }; }; } }; 'path': { name: 'path'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
31
- 'Query': { kind: 'OBJECT'; name: 'Query'; fields: { 'schema': { name: 'schema'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'Schema'; ofType: null; }; } }; }; };
32
- 'RequestBodyObject': { kind: 'OBJECT'; name: 'RequestBodyObject'; fields: { 'content': { name: 'content'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'MediaTypeObject'; ofType: null; }; }; } }; 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'required': { name: 'required'; type: { kind: 'SCALAR'; name: 'Boolean'; ofType: null; } }; }; };
33
- 'ResponseItem': { kind: 'OBJECT'; name: 'ResponseItem'; fields: { 'content': { name: 'content'; type: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'MediaTypeObject'; ofType: null; }; }; } }; 'description': { name: 'description'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'headers': { name: 'headers'; type: { kind: 'SCALAR'; name: 'JSON'; ofType: null; } }; 'links': { name: 'links'; type: { kind: 'SCALAR'; name: 'JSON'; ofType: null; } }; 'statusCode': { name: 'statusCode'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
34
- 'Schema': { kind: 'OBJECT'; name: 'Schema'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'openapi': { name: 'openapi'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'operations': { name: 'operations'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'OperationItem'; ofType: null; }; }; }; } }; 'paths': { name: 'paths'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'PathItem'; ofType: null; }; }; }; } }; 'tags': { name: 'tags'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'SchemaTag'; ofType: null; }; }; }; } }; 'title': { name: 'title'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'url': { name: 'url'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; 'version': { name: 'version'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
35
- 'SchemaTag': { kind: 'OBJECT'; name: 'SchemaTag'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'operations': { name: 'operations'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'LIST'; name: never; ofType: { kind: 'NON_NULL'; name: never; ofType: { kind: 'OBJECT'; name: 'OperationItem'; ofType: null; }; }; }; } }; }; };
36
- 'SchemaType': { name: 'SchemaType'; enumValues: 'json' | 'url' | 'yaml'; };
37
- 'String': unknown;
38
- 'TagItem': { kind: 'OBJECT'; name: 'TagItem'; fields: { 'description': { name: 'description'; type: { kind: 'SCALAR'; name: 'String'; ofType: null; } }; 'name': { name: 'name'; type: { kind: 'NON_NULL'; name: never; ofType: { kind: 'SCALAR'; name: 'String'; ofType: null; }; } }; }; };
39
- };
40
- };
41
-
42
- import * as gqlTada from "gql.tada";
43
-
44
- declare module "gql.tada" {
45
- interface setupSchema {
46
- introspection: introspection;
47
- }
48
- }