zudoku 0.3.0-dev.10 → 0.3.0-dev.12

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 (125) hide show
  1. package/dist/app/App.js +8 -6
  2. package/dist/app/App.js.map +1 -1
  3. package/dist/config/config.d.ts +5 -14
  4. package/dist/lib/authentication/authentication.d.ts +2 -2
  5. package/dist/lib/components/DevPortal.d.ts +2 -20
  6. package/dist/lib/components/DevPortal.js +13 -8
  7. package/dist/lib/components/DevPortal.js.map +1 -1
  8. package/dist/lib/components/Header.js +2 -2
  9. package/dist/lib/components/Header.js.map +1 -1
  10. package/dist/lib/components/Heading.d.ts +9 -4
  11. package/dist/lib/components/Heading.js +17 -2
  12. package/dist/lib/components/Heading.js.map +1 -1
  13. package/dist/lib/components/Layout.js +1 -1
  14. package/dist/lib/components/Layout.js.map +1 -1
  15. package/dist/lib/components/context/DevPortalProvider.d.ts +1 -1
  16. package/dist/lib/components/context/DevPortalProvider.js +2 -2
  17. package/dist/lib/components/context/DevPortalProvider.js.map +1 -1
  18. package/dist/lib/core/DevPortalContext.d.ts +33 -3
  19. package/dist/lib/core/DevPortalContext.js +4 -2
  20. package/dist/lib/core/DevPortalContext.js.map +1 -1
  21. package/dist/lib/core/plugins.d.ts +7 -4
  22. package/dist/lib/core/plugins.js +1 -0
  23. package/dist/lib/core/plugins.js.map +1 -1
  24. package/dist/lib/oas/graphql/index.js +1 -1
  25. package/dist/lib/oas/graphql/index.js.map +1 -1
  26. package/dist/lib/oas/parser/index.js +3 -1
  27. package/dist/lib/oas/parser/index.js.map +1 -1
  28. package/dist/lib/plugins/markdown/MdxPage.d.ts +3 -2
  29. package/dist/lib/plugins/markdown/MdxPage.js +5 -4
  30. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  31. package/dist/lib/plugins/markdown/generateRoutes.d.ts +2 -2
  32. package/dist/lib/plugins/markdown/generateRoutes.js +2 -2
  33. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
  34. package/dist/lib/plugins/markdown/index.d.ts +4 -1
  35. package/dist/lib/plugins/markdown/index.js +2 -2
  36. package/dist/lib/plugins/markdown/index.js.map +1 -1
  37. package/dist/lib/plugins/openapi/OperationList.js +4 -3
  38. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  39. package/dist/lib/plugins/openapi/OperationListItem.js +8 -4
  40. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  41. package/dist/lib/plugins/openapi/ParameterList.js +1 -1
  42. package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
  43. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  44. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  45. package/dist/lib/plugins/openapi/{MakeRequest.d.ts → PlaygroundDialogWrapper.d.ts} +1 -1
  46. package/dist/lib/plugins/openapi/{MakeRequest.js → PlaygroundDialogWrapper.js} +4 -4
  47. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
  48. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +1 -9
  49. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  50. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -1
  51. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  52. package/dist/lib/plugins/openapi/SchemaListView.js +4 -26
  53. package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
  54. package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +7 -0
  55. package/dist/lib/plugins/openapi/SchemaListViewItem.js +16 -0
  56. package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -0
  57. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.d.ts +8 -0
  58. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js +17 -0
  59. package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js.map +1 -0
  60. package/dist/lib/plugins/openapi/Sidecar.js +2 -2
  61. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  62. package/dist/lib/plugins/openapi/index.js +8 -0
  63. package/dist/lib/plugins/openapi/index.js.map +1 -1
  64. package/dist/lib/plugins/openapi/playground/Playground.d.ts +4 -4
  65. package/dist/lib/plugins/openapi/playground/Playground.js +7 -11
  66. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  67. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +3 -0
  68. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +10 -0
  69. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -0
  70. package/dist/lib/plugins/openapi/util/prose.d.ts +1 -0
  71. package/dist/lib/plugins/openapi/util/prose.js +4 -0
  72. package/dist/lib/plugins/openapi/util/prose.js.map +1 -0
  73. package/dist/lib/plugins/openapi/worker/worker.js +25 -1
  74. package/dist/lib/plugins/openapi/worker/worker.js.map +1 -1
  75. package/dist/lib/ui/button-variants.d.ts +1 -1
  76. package/dist/lib/util/MdxComponents.js +1 -1
  77. package/dist/lib/util/MdxComponents.js.map +1 -1
  78. package/dist/lib/util/objectEntries.d.ts +4 -0
  79. package/dist/lib/util/objectEntries.js +2 -0
  80. package/dist/lib/util/objectEntries.js.map +1 -0
  81. package/dist/lib/util/renderIf.d.ts +1 -0
  82. package/dist/lib/util/renderIf.js +2 -0
  83. package/dist/lib/util/renderIf.js.map +1 -0
  84. package/dist/vite/plugin-docs.js +1 -1
  85. package/dist/vite/plugin-docs.js.map +1 -1
  86. package/lib/{Spinner-DCwVN24H.js → Spinner-CbtkR-Im.js} +3249 -3232
  87. package/lib/assets/{worker-BCcpCNJ7.js → worker-DGvzLstc.js} +9843 -9800
  88. package/lib/zudoku.components.js +174 -161
  89. package/lib/zudoku.openapi-worker.js +12 -12
  90. package/lib/zudoku.plugins.js +3722 -3712
  91. package/package.json +2 -1
  92. package/src/app/App.tsx +9 -7
  93. package/src/lib/authentication/authentication.ts +2 -5
  94. package/src/lib/components/DevPortal.tsx +12 -27
  95. package/src/lib/components/Header.tsx +4 -4
  96. package/src/lib/components/Heading.tsx +26 -7
  97. package/src/lib/components/Layout.tsx +1 -1
  98. package/src/lib/components/context/DevPortalProvider.ts +2 -2
  99. package/src/lib/core/DevPortalContext.ts +38 -10
  100. package/src/lib/core/plugins.ts +10 -5
  101. package/src/lib/oas/graphql/index.ts +2 -2
  102. package/src/lib/oas/parser/index.ts +3 -1
  103. package/src/lib/plugins/markdown/MdxPage.tsx +49 -32
  104. package/src/lib/plugins/markdown/generateRoutes.tsx +12 -2
  105. package/src/lib/plugins/markdown/index.tsx +8 -1
  106. package/src/lib/plugins/openapi/OperationList.tsx +9 -3
  107. package/src/lib/plugins/openapi/OperationListItem.tsx +39 -18
  108. package/src/lib/plugins/openapi/ParameterList.tsx +1 -1
  109. package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
  110. package/src/lib/plugins/openapi/{MakeRequest.tsx → PlaygroundDialogWrapper.tsx} +3 -3
  111. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -17
  112. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -1
  113. package/src/lib/plugins/openapi/SchemaListView.tsx +15 -182
  114. package/src/lib/plugins/openapi/SchemaListViewItem.tsx +110 -0
  115. package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
  116. package/src/lib/plugins/openapi/Sidecar.tsx +2 -2
  117. package/src/lib/plugins/openapi/index.tsx +17 -4
  118. package/src/lib/plugins/openapi/playground/Playground.tsx +157 -187
  119. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +34 -0
  120. package/src/lib/plugins/openapi/util/prose.ts +7 -0
  121. package/src/lib/plugins/openapi/worker/worker.ts +27 -1
  122. package/src/lib/util/MdxComponents.tsx +1 -1
  123. package/src/lib/util/objectEntries.ts +5 -0
  124. package/src/lib/util/renderIf.ts +4 -0
  125. package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
@@ -1,15 +1,7 @@
1
- import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
2
1
  import { useMutation } from "@tanstack/react-query";
3
- import { CirclePlayIcon } from "lucide-react";
4
2
  import { Fragment } from "react";
5
3
  import { FormProvider, useForm } from "react-hook-form";
6
4
  import { useApiIdentities } from "../../../components/context/DevPortalProvider.js";
7
- import {
8
- Dialog,
9
- DialogContent,
10
- DialogTitle,
11
- DialogTrigger,
12
- } from "../../../components/Dialog.js";
13
5
  import {
14
6
  Select,
15
7
  SelectContent,
@@ -28,6 +20,8 @@ import { Headers } from "./Headers.js";
28
20
  import { PathParams } from "./PathParams.js";
29
21
  import { QueryParams } from "./QueryParams.js";
30
22
 
23
+ export const NO_IDENTITY = "__none";
24
+
31
25
  function mimeTypeToLanguage(mimeType: string) {
32
26
  const mimeTypeMapping = {
33
27
  "application/json": "json",
@@ -81,17 +75,7 @@ export type PlaygroundForm = {
81
75
  identity?: string;
82
76
  };
83
77
 
84
- export const NO_IDENTITY = "__none";
85
-
86
- const Playground = ({
87
- url,
88
- host,
89
- method,
90
- headers = [{ name: "", value: "" }],
91
- queryParams = [],
92
- pathParams = [],
93
- hasParams,
94
- }: {
78
+ export type PlaygroundContentProps = {
95
79
  host: string;
96
80
  url: string;
97
81
  method: string;
@@ -99,7 +83,17 @@ const Playground = ({
99
83
  queryParams?: QueryParam[];
100
84
  pathParams?: PathParam[];
101
85
  hasParams: boolean;
102
- }) => {
86
+ };
87
+
88
+ export const Playground = ({
89
+ host,
90
+ url,
91
+ method,
92
+ headers = [{ name: "", value: "" }],
93
+ queryParams = [],
94
+ pathParams = [],
95
+ hasParams,
96
+ }: PlaygroundContentProps) => {
103
97
  const { register, control, handleSubmit, watch, ...form } =
104
98
  useForm<PlaygroundForm>({
105
99
  defaultValues: {
@@ -129,7 +123,7 @@ const Playground = ({
129
123
 
130
124
  if (data.identity !== NO_IDENTITY) {
131
125
  identities.data
132
- .find((i) => i.id === data.identity)
126
+ ?.find((i) => i.id === data.identity)
133
127
  ?.authorizeRequest(request);
134
128
  }
135
129
  const response = await fetch(request);
@@ -181,181 +175,157 @@ const Playground = ({
181
175
  <wbr />
182
176
  </Fragment>
183
177
  ));
184
-
185
178
  return (
186
- <Dialog>
187
- <DialogTrigger asChild>
188
- <CirclePlayIcon
189
- className="cursor-pointer text-primary hover:text-primary/80"
190
- size={16}
191
- />
192
- </DialogTrigger>
193
-
194
- <DialogContent
195
- className="max-w-screen-xl w-full h-5/6 overflow-auto p-0"
196
- aria-describedby={undefined}
197
- >
198
- <VisuallyHidden>
199
- <DialogTitle>Playground</DialogTitle>
200
- </VisuallyHidden>
201
- <FormProvider {...{ register, control, handleSubmit, watch, ...form }}>
202
- <form
203
- onSubmit={handleSubmit((data) => queryMutation.mutateAsync(data))}
204
- >
205
- <div className="grid grid-cols-2 text-sm h-full">
206
- <div className="flex flex-col gap-4 p-8 bg-muted/50 after:bg-muted-foreground/20 relative after:absolute after:w-px after:inset-0 after:left-auto">
207
- <div className="flex gap-2 items-stretch">
208
- <div className="flex flex-1 items-center w-full border rounded-md border-border">
209
- <div className="border-r border-border p-2 bg-muted rounded-l-md self-stretch font-semibold font-mono">
210
- {method.toUpperCase()}
211
- </div>
212
- <div className="p-2 font-mono text-xs">
213
- {path}
214
- {urlQueryParams.length > 0 ? "?" : ""}
215
- {urlQueryParams}
179
+ <FormProvider {...{ register, control, handleSubmit, watch, ...form }}>
180
+ <form onSubmit={handleSubmit((data) => queryMutation.mutateAsync(data))}>
181
+ <div className="grid grid-cols-2 text-sm h-full">
182
+ <div className="flex flex-col gap-4 p-8 bg-muted/50 after:bg-muted-foreground/20 relative after:absolute after:w-px after:inset-0 after:left-auto">
183
+ <div className="flex gap-2 items-stretch">
184
+ <div className="flex flex-1 items-center w-full border rounded-md border-border">
185
+ <div className="border-r border-border p-2 bg-muted rounded-l-md self-stretch font-semibold font-mono">
186
+ {method.toUpperCase()}
187
+ </div>
188
+ <div className="p-2 font-mono text-xs">
189
+ {path}
190
+ {urlQueryParams.length > 0 ? "?" : ""}
191
+ {urlQueryParams}
192
+ </div>
193
+ </div>
194
+ <Button type="submit" className="h-auto flex gap-1">
195
+ Send
196
+ </Button>
197
+ </div>
198
+ <Tabs defaultValue={hasParams ? "parameters" : "headers"}>
199
+ <div className="flex justify-between">
200
+ <TabsList>
201
+ {hasParams && (
202
+ <TabsTrigger value="parameters">Parameters</TabsTrigger>
203
+ )}
204
+ <TabsTrigger value="headers">
205
+ Headers{" "}
206
+ {formState.headers.length > 0 &&
207
+ `(${formState.headers.length})`}
208
+ </TabsTrigger>
209
+ <TabsTrigger
210
+ value="body"
211
+ disabled={["POST", "PUT", "PATCH", "DELETE"].includes(
212
+ method.toUpperCase(),
213
+ )}
214
+ >
215
+ Body
216
+ </TabsTrigger>
217
+ </TabsList>
218
+ <div className="flex gap-2 items-center">
219
+ Auth:
220
+ <Select
221
+ onValueChange={(value) => form.setValue("identity", value)}
222
+ defaultValue={formState.identity}
223
+ >
224
+ <SelectTrigger className="w-[180px] flex">
225
+ {identities.isPending ? <Spinner /> : <SelectValue />}
226
+ </SelectTrigger>
227
+ <SelectContent align="center">
228
+ <SelectItem value={NO_IDENTITY}>None</SelectItem>
229
+ {identities.data?.map((identity) => (
230
+ <SelectItem key={identity.id} value={identity.id}>
231
+ {identity.label}
232
+ </SelectItem>
233
+ ))}
234
+ </SelectContent>
235
+ </Select>
236
+ </div>
237
+ </div>
238
+ <TabsContent value="headers">
239
+ <Headers control={control} register={register} />
240
+ </TabsContent>
241
+ <TabsContent value="parameters">
242
+ <div className="grid grid-cols-[min-content_1fr_1fr_auto]">
243
+ {pathParams.length > 0 && (
244
+ <div className="font-semibold my-3 col-span-3">
245
+ Path Parameters
216
246
  </div>
217
- </div>
218
- <Button type="submit" className="h-auto flex gap-1">
219
- Send
220
- </Button>
247
+ )}
248
+ <PathParams control={control} register={register} />
249
+ {queryParams.length > 0 && (
250
+ <span className="font-semibold my-3 col-span-3">
251
+ Query Parameters
252
+ </span>
253
+ )}
254
+ <QueryParams control={control} />
221
255
  </div>
222
- <Tabs defaultValue={hasParams ? "parameters" : "headers"}>
223
- <div className="flex justify-between">
224
- <TabsList>
225
- {hasParams && (
226
- <TabsTrigger value="parameters">Parameters</TabsTrigger>
227
- )}
228
- <TabsTrigger value="headers">
229
- Headers{" "}
230
- {formState.headers.length > 0 &&
231
- `(${formState.headers.length})`}
232
- </TabsTrigger>
233
- <TabsTrigger
234
- value="body"
235
- disabled={["POST", "PUT", "PATCH", "DELETE"].includes(
236
- method.toUpperCase(),
237
- )}
238
- >
239
- Body
240
- </TabsTrigger>
241
- </TabsList>
242
- <div className="flex gap-2 items-center">
243
- Auth:
244
- <Select
245
- onValueChange={(value) =>
246
- form.setValue("identity", value)
247
- }
248
- defaultValue={formState.identity}
249
- >
250
- <SelectTrigger className="w-[180px]">
251
- <SelectValue />
252
- </SelectTrigger>
253
- <SelectContent align="center">
254
- <SelectItem value={NO_IDENTITY}>None</SelectItem>
255
- {identities.data.map((identity) => (
256
- <SelectItem key={identity.id} value={identity.id}>
257
- {identity.label}
258
- </SelectItem>
259
- ))}
260
- </SelectContent>
261
- </Select>
256
+ </TabsContent>
257
+ <TabsContent value="body">
258
+ <textarea
259
+ {...register("body")}
260
+ className="border border-border w-full rounded p-2 bg-muted h-40"
261
+ />
262
+ </TabsContent>
263
+ </Tabs>
264
+ </div>
265
+ <div className="flex flex-col gap-4 p-8 bg-muted/70">
266
+ {queryMutation.error ? (
267
+ <div>{queryMutation.error.message}</div>
268
+ ) : queryMutation.data ? (
269
+ <div className="flex flex-col gap-2">
270
+ <div className="flex gap-2">
271
+ <div className="flex text-xs gap-6">
272
+ <div>
273
+ Status: {queryMutation.data.status}{" "}
274
+ {statusCodeMap[queryMutation.data.status] ?? ""}
262
275
  </div>
276
+ <div>Time: {queryMutation.data.time.toFixed(0)}ms</div>
277
+ <div>Size: {queryMutation.data.size} B</div>
263
278
  </div>
264
- <TabsContent value="headers">
265
- <Headers control={control} register={register} />
266
- </TabsContent>
267
- <TabsContent value="parameters">
268
- <div className="grid grid-cols-[min-content_1fr_1fr_auto]">
269
- {pathParams.length > 0 && (
270
- <div className="font-semibold my-3 col-span-3">
271
- Path Parameters
272
- </div>
273
- )}
274
- <PathParams control={control} register={register} />
275
- {queryParams.length > 0 && (
276
- <span className="font-semibold my-3 col-span-3">
277
- Query Parameters
278
- </span>
279
- )}
280
- <QueryParams control={control} />
281
- </div>
279
+ </div>
280
+ {/*<UrlDisplay host={host} path={url} />*/}
281
+ <Tabs defaultValue="response">
282
+ <TabsList>
283
+ <TabsTrigger value="response">Response</TabsTrigger>
284
+ <TabsTrigger value="headers">
285
+ {headerEntries.length
286
+ ? `Headers (${headerEntries.length})`
287
+ : "No headers"}
288
+ </TabsTrigger>
289
+ </TabsList>
290
+
291
+ <TabsContent value="response">
292
+ <Card className="shadow-none p-4">
293
+ <SyntaxHighlight
294
+ language={lang ?? "json"}
295
+ noBackground
296
+ className="overflow-x-auto "
297
+ code={queryMutation.data.body ?? JSON.stringify("")}
298
+ />
299
+ </Card>
282
300
  </TabsContent>
283
- <TabsContent value="body">
284
- <textarea
285
- {...register("body")}
286
- className="border border-border w-full rounded p-2 bg-muted h-40"
287
- />
301
+ <TabsContent value="headers">
302
+ <Card className="grid grid-cols-2 w-full gap-2.5 font-mono text-xs shadow-none p-4">
303
+ <div className="font-semibold">Key</div>
304
+ <div className="font-semibold">Value</div>
305
+ {headerEntries.map(([key, value]) => (
306
+ <Fragment key={key}>
307
+ <div>{key}</div>
308
+ <div>{value}</div>
309
+ </Fragment>
310
+ ))}
311
+ </Card>
288
312
  </TabsContent>
289
313
  </Tabs>
290
314
  </div>
291
- <div className="flex flex-col gap-4 p-8 bg-muted/70">
292
- {queryMutation.error ? (
293
- <div>{queryMutation.error.message}</div>
294
- ) : queryMutation.data ? (
295
- <div className="flex flex-col gap-2">
296
- <div className="flex gap-2">
297
- <div className="flex text-xs gap-6">
298
- <div>
299
- Status: {queryMutation.data.status}{" "}
300
- {statusCodeMap[queryMutation.data.status] ?? ""}
301
- </div>
302
- <div>Time: {queryMutation.data.time.toFixed(0)}ms</div>
303
- <div>Size: {queryMutation.data.size} B</div>
304
- </div>
305
- </div>
306
- {/*<UrlDisplay host={host} path={url} />*/}
307
- <Tabs defaultValue="response">
308
- <TabsList>
309
- <TabsTrigger value="response">Response</TabsTrigger>
310
- <TabsTrigger value="headers">
311
- {headerEntries.length
312
- ? `Headers (${headerEntries.length})`
313
- : "No headers"}
314
- </TabsTrigger>
315
- </TabsList>
316
-
317
- <TabsContent value="response">
318
- <Card className="shadow-none p-4">
319
- <SyntaxHighlight
320
- language={lang ?? "json"}
321
- noBackground
322
- className="overflow-x-auto "
323
- code={queryMutation.data.body ?? JSON.stringify("")}
324
- />
325
- </Card>
326
- </TabsContent>
327
- <TabsContent value="headers">
328
- <Card className="grid grid-cols-2 w-full gap-2.5 font-mono text-xs shadow-none p-4">
329
- <div className="font-semibold">Key</div>
330
- <div className="font-semibold">Value</div>
331
- {headerEntries.map(([key, value]) => (
332
- <Fragment key={key}>
333
- <div>{key}</div>
334
- <div>{value}</div>
335
- </Fragment>
336
- ))}
337
- </Card>
338
- </TabsContent>
339
- </Tabs>
340
- </div>
341
- ) : (
342
- <div className="grid place-items-center h-full">
343
- <span className="text-[16px] font-semibold text-muted-foreground">
344
- {queryMutation.isPending ? (
345
- <Spinner />
346
- ) : (
347
- "Send a request first to see the response here"
348
- )}
349
- </span>
350
- </div>
351
- )}
315
+ ) : (
316
+ <div className="grid place-items-center h-full">
317
+ <span className="text-[16px] font-semibold text-muted-foreground">
318
+ {queryMutation.isPending ? (
319
+ <Spinner />
320
+ ) : (
321
+ "Send a request first to see the response here"
322
+ )}
323
+ </span>
352
324
  </div>
353
- </div>
354
- </form>
355
- </FormProvider>
356
- </DialogContent>
357
- </Dialog>
325
+ )}
326
+ </div>
327
+ </div>
328
+ </form>
329
+ </FormProvider>
358
330
  );
359
331
  };
360
-
361
- export { Playground };
@@ -0,0 +1,34 @@
1
+ import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
2
+ import { CirclePlayIcon } from "lucide-react";
3
+ import {
4
+ Dialog,
5
+ DialogContent,
6
+ DialogTitle,
7
+ DialogTrigger,
8
+ } from "../../../components/Dialog.js";
9
+ import { Playground, type PlaygroundContentProps } from "./Playground.js";
10
+
11
+ const PlaygroundDialog = (props: PlaygroundContentProps) => {
12
+ return (
13
+ <Dialog>
14
+ <DialogTrigger asChild>
15
+ <CirclePlayIcon
16
+ className="cursor-pointer text-primary hover:text-primary/80"
17
+ size={16}
18
+ />
19
+ </DialogTrigger>
20
+
21
+ <DialogContent
22
+ className="max-w-screen-xl w-full h-5/6 overflow-auto p-0"
23
+ aria-describedby={undefined}
24
+ >
25
+ <VisuallyHidden>
26
+ <DialogTitle>Playground</DialogTitle>
27
+ </VisuallyHidden>
28
+ <Playground {...props} />
29
+ </DialogContent>
30
+ </Dialog>
31
+ );
32
+ };
33
+
34
+ export { PlaygroundDialog };
@@ -0,0 +1,7 @@
1
+ import { ProseClasses } from "../../../components/Markdown.js";
2
+ import { cn } from "../../../util/cn.js";
3
+
4
+ export const SchemaProseClasses = cn(
5
+ ProseClasses,
6
+ "max-w-full prose-img:max-w-prose",
7
+ );
@@ -1,7 +1,33 @@
1
+ import { useLogger } from "@envelop/core";
1
2
  import { createGraphQLServer } from "../../../oas/graphql/index.js";
2
3
  import { type WorkerGraphQLMessage } from "./createSharedWorkerClient.js";
3
4
 
4
- const localServer = createGraphQLServer();
5
+ const map = new Map<string, number>();
6
+
7
+ const localServer = createGraphQLServer({
8
+ plugins: [
9
+ // eslint-disable-next-line react-hooks/rules-of-hooks
10
+ useLogger({
11
+ logFn: (eventName, { args }) => {
12
+ if (import.meta.env.PROD) return;
13
+
14
+ if (eventName.endsWith("-start")) {
15
+ map.set(`${eventName}-${args.operationName}`, performance.now());
16
+ } else if (eventName.endsWith("-end")) {
17
+ const startEvent = eventName.replace("-end", "-start");
18
+ const start = map.get(`${startEvent}-${args.operationName}`);
19
+ if (start) {
20
+ // eslint-disable-next-line no-console
21
+ console.log(
22
+ `${args.operationName} query took ${performance.now() - start}ms`,
23
+ );
24
+ map.delete(`${startEvent}-${args.operationName}`);
25
+ }
26
+ }
27
+ },
28
+ }),
29
+ ],
30
+ });
5
31
 
6
32
  const worker = self as unknown as SharedWorkerGlobalScope;
7
33
 
@@ -74,7 +74,7 @@ export const MdxComponents = {
74
74
  return (
75
75
  <SyntaxHighlight
76
76
  language={match?.[1] ?? "markup"}
77
- className="rounded-xl overflow-x-auto p-4 border border-border dark:!bg-foreground/10 dark:border-transparent"
77
+ className="rounded-xl overflow-x-auto p-4 border border-border dark:!bg-foreground/10 dark:border-transparent whitespace-nowrap"
78
78
  showLanguageIndicator
79
79
  code={String(children).trim()}
80
80
  />
@@ -0,0 +1,5 @@
1
+ type ValueOf<T> = T[keyof T];
2
+ type Entries<T> = [keyof T, ValueOf<T>][];
3
+
4
+ export const objectEntries = <T extends object>(obj: T): Entries<T> =>
5
+ Object.entries(obj) as Entries<T>;
@@ -0,0 +1,4 @@
1
+ export const renderIf = <G, R>(
2
+ variable: G | undefined | null,
3
+ callback: (variable: G) => R,
4
+ ): R | undefined => (variable ? callback(variable) : undefined);
@@ -1 +0,0 @@
1
- {"version":3,"file":"MakeRequest.js","sourceRoot":"","sources":["../../../../src/lib/plugins/openapi/MakeRequest.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;;;;;;CAM5C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,SAAS,GAGV,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,CAAC,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