zudoku 0.1.1-dev.29 → 0.1.1-dev.30

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 (51) hide show
  1. package/dist/lib/components/Dialog.js +1 -1
  2. package/dist/lib/components/Dialog.js.map +1 -1
  3. package/dist/lib/components/SyntaxHighlight.d.ts +1 -1
  4. package/dist/lib/components/SyntaxHighlight.js +3 -0
  5. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  6. package/dist/lib/plugins/openapi/ColorizedParam.d.ts +1 -2
  7. package/dist/lib/plugins/openapi/ColorizedParam.js +1 -1
  8. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
  9. package/dist/lib/plugins/openapi/MakeRequest.js +1 -1
  10. package/dist/lib/plugins/openapi/MakeRequest.js.map +1 -1
  11. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  12. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  13. package/dist/lib/plugins/openapi/playground/Editor.d.ts +1 -0
  14. package/dist/lib/plugins/openapi/playground/Editor.js +5 -0
  15. package/dist/lib/plugins/openapi/playground/Editor.js.map +1 -0
  16. package/dist/lib/plugins/openapi/playground/Headers.d.ts +7 -0
  17. package/dist/lib/plugins/openapi/playground/Headers.js +26 -0
  18. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -0
  19. package/dist/lib/plugins/openapi/playground/InlineInput.d.ts +3 -0
  20. package/dist/lib/plugins/openapi/playground/InlineInput.js +3 -0
  21. package/dist/lib/plugins/openapi/playground/InlineInput.js.map +1 -0
  22. package/dist/lib/plugins/openapi/playground/Playground.d.ts +18 -1
  23. package/dist/lib/plugins/openapi/playground/Playground.js +60 -71
  24. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  25. package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +7 -0
  26. package/dist/lib/plugins/openapi/playground/QueryParams.js +30 -0
  27. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -0
  28. package/dist/lib/plugins/openapi/playground/UrlParts.d.ts +6 -0
  29. package/dist/lib/plugins/openapi/playground/UrlParts.js +21 -0
  30. package/dist/lib/plugins/openapi/playground/UrlParts.js.map +1 -0
  31. package/dist/lib/util/createVariantComponent.d.ts +3 -10
  32. package/dist/lib/util/createVariantComponent.js +3 -2
  33. package/dist/lib/util/createVariantComponent.js.map +1 -1
  34. package/lib/{DevPortal-ChiyAyW7.js → DevPortal-COMmOqxP.js} +4082 -4379
  35. package/lib/assets/{worker-CnXQsqxH.js → worker-W78u54MC.js} +2840 -2878
  36. package/lib/zudoku.components.js +1 -1
  37. package/lib/zudoku.openapi-worker.js +5 -5
  38. package/lib/zudoku.plugins.js +8197 -6903
  39. package/package.json +10 -1
  40. package/src/lib/components/Dialog.tsx +32 -32
  41. package/src/lib/components/SyntaxHighlight.tsx +4 -0
  42. package/src/lib/plugins/openapi/ColorizedParam.tsx +0 -2
  43. package/src/lib/plugins/openapi/MakeRequest.tsx +1 -1
  44. package/src/lib/plugins/openapi/ParameterListItem.tsx +4 -1
  45. package/src/lib/plugins/openapi/playground/Editor.tsx +6 -0
  46. package/src/lib/plugins/openapi/playground/Headers.tsx +66 -0
  47. package/src/lib/plugins/openapi/playground/InlineInput.tsx +6 -0
  48. package/src/lib/plugins/openapi/playground/Playground.tsx +191 -226
  49. package/src/lib/plugins/openapi/playground/QueryParams.tsx +79 -0
  50. package/src/lib/plugins/openapi/playground/UrlParts.tsx +67 -0
  51. package/src/lib/util/createVariantComponent.tsx +7 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.1.1-dev.29",
3
+ "version": "0.1.1-dev.30",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -51,6 +51,7 @@
51
51
  "@lekoarts/rehype-meta-as-attributes": "3.0.1",
52
52
  "@mdx-js/react": "3.0.1",
53
53
  "@mdx-js/rollup": "3.0.1",
54
+ "@monaco-editor/react": "^4.6.0",
54
55
  "@pothos/core": "3.41.0",
55
56
  "@sentry/node": "8.11.0",
56
57
  "@stefanprobst/rehype-extract-toc": "2.2.0",
@@ -71,6 +72,14 @@
71
72
  "picocolors": "^1.0.1",
72
73
  "postcss": "8.4.39",
73
74
  "posthog-node": "^4.0.1",
75
+ "prism-react-renderer": "2.3.1",
76
+ "prismjs": "1.29.0",
77
+ "react": "18.3.1",
78
+ "react-dom": "18.3.1",
79
+ "react-helmet-async": "2.0.5",
80
+ "react-hook-form": "^7.52.1",
81
+ "react-markdown": "9.0.1",
82
+ "react-router-dom": "6.23.0",
74
83
  "rehype-slug": "6.0.0",
75
84
  "remark-comment": "1.0.0",
76
85
  "remark-directive": "3.0.0",
@@ -1,15 +1,15 @@
1
- import * as React from "react"
2
- import * as DialogPrimitive from "@radix-ui/react-dialog"
3
- import { XIcon } from "lucide-react"
1
+ import * as React from "react";
2
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
3
+ import { XIcon } from "lucide-react";
4
4
  import { cn } from "../util/cn.js";
5
5
 
6
- const Dialog = DialogPrimitive.Root
6
+ const Dialog = DialogPrimitive.Root;
7
7
 
8
- const DialogTrigger = DialogPrimitive.Trigger
8
+ const DialogTrigger = DialogPrimitive.Trigger;
9
9
 
10
- const DialogPortal = DialogPrimitive.Portal
10
+ const DialogPortal = DialogPrimitive.Portal;
11
11
 
12
- const DialogClose = DialogPrimitive.Close
12
+ const DialogClose = DialogPrimitive.Close;
13
13
 
14
14
  const DialogOverlay = React.forwardRef<
15
15
  React.ElementRef<typeof DialogPrimitive.Overlay>,
@@ -19,12 +19,12 @@ const DialogOverlay = React.forwardRef<
19
19
  ref={ref}
20
20
  className={cn(
21
21
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
22
- className
22
+ className,
23
23
  )}
24
24
  {...props}
25
25
  />
26
- ))
27
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
26
+ ));
27
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
28
28
 
29
29
  const DialogContent = React.forwardRef<
30
30
  React.ElementRef<typeof DialogPrimitive.Content>,
@@ -35,8 +35,8 @@ const DialogContent = React.forwardRef<
35
35
  <DialogPrimitive.Content
36
36
  ref={ref}
37
37
  className={cn(
38
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
39
- className
38
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg border-border",
39
+ className,
40
40
  )}
41
41
  {...props}
42
42
  >
@@ -47,36 +47,36 @@ const DialogContent = React.forwardRef<
47
47
  </DialogPrimitive.Close>
48
48
  </DialogPrimitive.Content>
49
49
  </DialogPortal>
50
- ))
51
- DialogContent.displayName = DialogPrimitive.Content.displayName
50
+ ));
51
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
52
52
 
53
53
  const DialogHeader = ({
54
- className,
55
- ...props
56
- }: React.HTMLAttributes<HTMLDivElement>) => (
54
+ className,
55
+ ...props
56
+ }: React.HTMLAttributes<HTMLDivElement>) => (
57
57
  <div
58
58
  className={cn(
59
59
  "flex flex-col space-y-1.5 text-center sm:text-left",
60
- className
60
+ className,
61
61
  )}
62
62
  {...props}
63
63
  />
64
- )
65
- DialogHeader.displayName = "DialogHeader"
64
+ );
65
+ DialogHeader.displayName = "DialogHeader";
66
66
 
67
67
  const DialogFooter = ({
68
- className,
69
- ...props
70
- }: React.HTMLAttributes<HTMLDivElement>) => (
68
+ className,
69
+ ...props
70
+ }: React.HTMLAttributes<HTMLDivElement>) => (
71
71
  <div
72
72
  className={cn(
73
73
  "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
74
- className
74
+ className,
75
75
  )}
76
76
  {...props}
77
77
  />
78
- )
79
- DialogFooter.displayName = "DialogFooter"
78
+ );
79
+ DialogFooter.displayName = "DialogFooter";
80
80
 
81
81
  const DialogTitle = React.forwardRef<
82
82
  React.ElementRef<typeof DialogPrimitive.Title>,
@@ -86,12 +86,12 @@ const DialogTitle = React.forwardRef<
86
86
  ref={ref}
87
87
  className={cn(
88
88
  "text-lg font-semibold leading-none tracking-tight",
89
- className
89
+ className,
90
90
  )}
91
91
  {...props}
92
92
  />
93
- ))
94
- DialogTitle.displayName = DialogPrimitive.Title.displayName
93
+ ));
94
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
95
95
 
96
96
  const DialogDescription = React.forwardRef<
97
97
  React.ElementRef<typeof DialogPrimitive.Description>,
@@ -102,8 +102,8 @@ const DialogDescription = React.forwardRef<
102
102
  className={cn("text-sm text-muted-foreground", className)}
103
103
  {...props}
104
104
  />
105
- ))
106
- DialogDescription.displayName = DialogPrimitive.Description.displayName
105
+ ));
106
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
107
107
 
108
108
  export {
109
109
  Dialog,
@@ -116,4 +116,4 @@ export {
116
116
  DialogFooter,
117
117
  DialogTitle,
118
118
  DialogDescription,
119
- }
119
+ };
@@ -41,6 +41,10 @@ export const SyntaxHighlight = ({
41
41
  const [isDark] = useTheme();
42
42
  const [isCopied, setIsCopied] = useState(false);
43
43
 
44
+ if (!props.code) {
45
+ return null;
46
+ }
47
+
44
48
  return (
45
49
  <Highlight theme={isDark ? themes.vsDark : themes.github} {...props}>
46
50
  {({ className, style, tokens, getLineProps, getTokenProps }) => (
@@ -15,7 +15,6 @@ export const usePastellizedColor = (name: string) => {
15
15
 
16
16
  export const ColorizedParam = ({
17
17
  name,
18
- value,
19
18
  className,
20
19
  backgroundOpacity = "100%",
21
20
  slug,
@@ -23,7 +22,6 @@ export const ColorizedParam = ({
23
22
  onClick,
24
23
  }: {
25
24
  name: string;
26
- value?: string;
27
25
  className?: string;
28
26
  backgroundOpacity?: string;
29
27
  slug?: string;
@@ -27,7 +27,7 @@ export const MakeRequest = ({
27
27
  host={server.data?.schema.url}
28
28
  method={operation.method}
29
29
  url={operation.path}
30
- defaultHeaders={[]}
30
+ // defaultHeaders={}
31
31
  />
32
32
  {identities.data.map((identity) => (
33
33
  <button
@@ -54,7 +54,10 @@ export const ParameterListItem = ({
54
54
  )}
55
55
  </div>
56
56
  {parameter.description && (
57
- <Markdown content={parameter.description} className="prose-p:my-1" />
57
+ <Markdown
58
+ content={parameter.description}
59
+ className="text-sm prose-p:my-1"
60
+ />
58
61
  )}
59
62
  </li>
60
63
  );
@@ -0,0 +1,6 @@
1
+ import { lazy } from "react";
2
+
3
+ export const Editor = () => {
4
+ // const XoXo = lazy(() => import("@monaco-editor/react"));
5
+ // return <XoXo />;
6
+ };
@@ -0,0 +1,66 @@
1
+ import { Control, useFieldArray, UseFormRegister } from "react-hook-form";
2
+ import { TrashIcon } from "lucide-react";
3
+ import { InlineInput } from "./InlineInput.js";
4
+ import type { PlaygroundForm, Header } from "./Playground.js";
5
+ import { useEffect } from "react";
6
+
7
+ export const Headers = ({
8
+ control,
9
+ register,
10
+ headers,
11
+ }: {
12
+ register: UseFormRegister<PlaygroundForm>;
13
+ control: Control<PlaygroundForm>;
14
+ headers: Header[];
15
+ }) => {
16
+ const { fields, append, remove } = useFieldArray<PlaygroundForm>({
17
+ control,
18
+ name: "headers",
19
+ });
20
+
21
+ const headersCount = headers.length;
22
+ const headersLastName = headers.at(-1)?.name;
23
+ const headersValue = headers.at(-1)?.value;
24
+
25
+ useEffect(() => {
26
+ if (headersCount === 0) {
27
+ append({ name: "", value: "" });
28
+ }
29
+ if (headersLastName !== "" || headersValue !== "") {
30
+ append({ name: "", value: "" });
31
+ }
32
+ }, [append, headersCount, headersLastName, headersValue]);
33
+
34
+ return (
35
+ <div className="grid grid-cols-[1fr_1fr_auto]">
36
+ {fields.map((header, i) => (
37
+ <div
38
+ key={header.id}
39
+ className="grid-cols-subgrid col-span-full grid items-center gap-x-2 has-[:focus]:bg-muted hover:bg-muted rounded overflow-hidden group"
40
+ >
41
+ {/*<input type="checkbox" />*/}
42
+ <InlineInput
43
+ {...register(`headers.${i}.name`)}
44
+ placeholder="Name"
45
+ className="peer"
46
+ />
47
+ <InlineInput
48
+ placeholder={"Value"}
49
+ className="peer"
50
+ {...register(`headers.${i}.value`)}
51
+ />
52
+ <button
53
+ className="hover:bg-black/5 p-1 rounded mr-2 text-muted-foreground invisible group-hover:visible peer-focus:visible"
54
+ onClick={() => {
55
+ remove(i);
56
+ }}
57
+ disabled={fields.length === 1}
58
+ >
59
+ <TrashIcon size={16} />
60
+ </button>
61
+ <div className="col-span-full border-b border-border"></div>
62
+ </div>
63
+ ))}
64
+ </div>
65
+ );
66
+ };
@@ -0,0 +1,6 @@
1
+ import createVariantComponent from "../../../util/createVariantComponent.js";
2
+
3
+ export const InlineInput = createVariantComponent(
4
+ "input",
5
+ "px-2 bg-transparent h-8 font-mono text-xs m-2",
6
+ );