zudoku 0.38.0 → 0.39.0

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 (177) hide show
  1. package/dist/app/tailwind.js +14 -0
  2. package/dist/app/tailwind.js.map +1 -1
  3. package/dist/lib/components/Heading.d.ts +1 -1
  4. package/dist/lib/components/Layout.js +2 -9
  5. package/dist/lib/components/Layout.js.map +1 -1
  6. package/dist/lib/components/Main.js +3 -1
  7. package/dist/lib/components/Main.js.map +1 -1
  8. package/dist/lib/components/Pagination.d.ts +10 -0
  9. package/dist/lib/components/Pagination.js +10 -0
  10. package/dist/lib/components/Pagination.js.map +1 -0
  11. package/dist/lib/components/TopNavigation.js +18 -2
  12. package/dist/lib/components/TopNavigation.js.map +1 -1
  13. package/dist/lib/components/navigation/SidebarItem.d.ts +1 -0
  14. package/dist/lib/components/navigation/SidebarItem.js +7 -3
  15. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  16. package/dist/lib/{plugins/markdown → components/navigation}/Toc.js +5 -7
  17. package/dist/lib/components/navigation/Toc.js.map +1 -0
  18. package/dist/lib/oas/graphql/index.d.ts +2 -1
  19. package/dist/lib/oas/graphql/index.js +74 -14
  20. package/dist/lib/oas/graphql/index.js.map +1 -1
  21. package/dist/lib/oas/parser/dereference/index.js +2 -0
  22. package/dist/lib/oas/parser/dereference/index.js.map +1 -1
  23. package/dist/lib/oas/parser/index.d.ts +5 -3
  24. package/dist/lib/oas/parser/index.js +0 -22
  25. package/dist/lib/oas/parser/index.js.map +1 -1
  26. package/dist/lib/plugins/api-catalog/index.js +19 -17
  27. package/dist/lib/plugins/api-catalog/index.js.map +1 -1
  28. package/dist/lib/plugins/markdown/MdxPage.js +3 -3
  29. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  30. package/dist/lib/plugins/openapi/ColorizedParam.js +1 -1
  31. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
  32. package/dist/lib/plugins/openapi/OperationList.d.ts +1 -1
  33. package/dist/lib/plugins/openapi/OperationList.js +28 -8
  34. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  35. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  36. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  37. package/dist/lib/plugins/openapi/ParameterListItem.js +2 -1
  38. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  39. package/dist/lib/plugins/openapi/SchemaList.d.ts +1 -0
  40. package/dist/lib/plugins/openapi/SchemaList.js +52 -0
  41. package/dist/lib/plugins/openapi/SchemaList.js.map +1 -0
  42. package/dist/lib/plugins/openapi/client/GraphQLClient.d.ts +1 -1
  43. package/dist/lib/plugins/openapi/client/GraphQLClient.js +1 -1
  44. package/dist/lib/plugins/openapi/client/GraphQLClient.js.map +1 -1
  45. package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +6 -2
  46. package/dist/lib/plugins/openapi/client/useCreateQuery.js +5 -5
  47. package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -1
  48. package/dist/lib/plugins/openapi/components/EnumValues.js +1 -1
  49. package/dist/lib/plugins/openapi/components/EnumValues.js.map +1 -1
  50. package/dist/lib/plugins/openapi/graphql/gql.d.ts +6 -2
  51. package/dist/lib/plugins/openapi/graphql/gql.js +3 -2
  52. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  53. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +67 -11
  54. package/dist/lib/plugins/openapi/graphql/graphql.js +34 -5
  55. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  56. package/dist/lib/plugins/openapi/index.js +12 -0
  57. package/dist/lib/plugins/openapi/index.js.map +1 -1
  58. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.d.ts +1 -2
  59. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js +2 -2
  60. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js.map +1 -1
  61. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.d.ts +0 -1
  62. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js +1 -1
  63. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js.map +1 -1
  64. package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.d.ts +4 -0
  65. package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js +12 -0
  66. package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js.map +1 -0
  67. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.d.ts +2 -4
  68. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +12 -9
  69. package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
  70. package/dist/lib/plugins/openapi/schema/SchemaView.d.ts +1 -2
  71. package/dist/lib/plugins/openapi/schema/SchemaView.js +30 -52
  72. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  73. package/dist/lib/plugins/openapi/schema/utils.d.ts +1 -0
  74. package/dist/lib/plugins/openapi/schema/utils.js +3 -1
  75. package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
  76. package/dist/lib/plugins/openapi/util/getRoutes.js +9 -3
  77. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  78. package/dist/lib/util/useOnScreen.d.ts +3 -2
  79. package/dist/lib/util/useOnScreen.js +3 -3
  80. package/dist/lib/util/useOnScreen.js.map +1 -1
  81. package/dist/vite/api/schema-codegen.js +2 -2
  82. package/dist/vite/api/schema-codegen.js.map +1 -1
  83. package/dist/vite/api/schema-codegen.test.js +5 -0
  84. package/dist/vite/api/schema-codegen.test.js.map +1 -1
  85. package/dist/vite/plugin-api.js +8 -7
  86. package/dist/vite/plugin-api.js.map +1 -1
  87. package/lib/{AuthenticationPlugin-Duy_R1TU.js → AuthenticationPlugin-foqdvvkf.js} +2 -2
  88. package/lib/{AuthenticationPlugin-Duy_R1TU.js.map → AuthenticationPlugin-foqdvvkf.js.map} +1 -1
  89. package/lib/{Callout-B2vsR09t.js → Callout-D5frCCJ0.js} +2 -2
  90. package/lib/{Callout-B2vsR09t.js.map → Callout-D5frCCJ0.js.map} +1 -1
  91. package/lib/{Dialog-sbgekbjb.js → Dialog-Dv6WG8RN.js} +5 -5
  92. package/lib/{Dialog-sbgekbjb.js.map → Dialog-Dv6WG8RN.js.map} +1 -1
  93. package/lib/{Markdown-DIZ8nBVC.js → Markdown-aF5FdsNi.js} +1339 -1335
  94. package/lib/{Markdown-DIZ8nBVC.js.map → Markdown-aF5FdsNi.js.map} +1 -1
  95. package/lib/MdxPage-ZW1StNhp.js +83 -0
  96. package/lib/MdxPage-ZW1StNhp.js.map +1 -0
  97. package/lib/{OasProvider-D1A10JeA.js → OasProvider-Cld9RAMQ.js} +3 -3
  98. package/lib/{OasProvider-D1A10JeA.js.map → OasProvider-Cld9RAMQ.js.map} +1 -1
  99. package/lib/OperationList-D-OfzJm6.js +5065 -0
  100. package/lib/OperationList-D-OfzJm6.js.map +1 -0
  101. package/lib/Pagination-CYB3nVYx.js +46 -0
  102. package/lib/Pagination-CYB3nVYx.js.map +1 -0
  103. package/lib/SchemaList-Ci1WxRh0.js +148 -0
  104. package/lib/SchemaList-Ci1WxRh0.js.map +1 -0
  105. package/lib/SchemaView-Brn-YxHY.js +345 -0
  106. package/lib/SchemaView-Brn-YxHY.js.map +1 -0
  107. package/lib/{Select-fAYcJ0OU.js → Select-DVFRKf1R.js} +3 -3
  108. package/lib/{Select-fAYcJ0OU.js.map → Select-DVFRKf1R.js.map} +1 -1
  109. package/lib/{SlotletProvider-BEwNY8q0.js → SlotletProvider-DXvc0aY6.js} +2 -2
  110. package/lib/{SlotletProvider-BEwNY8q0.js.map → SlotletProvider-DXvc0aY6.js.map} +1 -1
  111. package/lib/Toc-YBsgI72s.js +92 -0
  112. package/lib/Toc-YBsgI72s.js.map +1 -0
  113. package/lib/{createServer-DjgKDpGV.js → createServer-mMau3eV_.js} +1732 -1664
  114. package/lib/{createServer-DjgKDpGV.js.map → createServer-mMau3eV_.js.map} +1 -1
  115. package/lib/{hook-Cge6LiTK.js → hook-CqpVYDqN.js} +28 -28
  116. package/lib/{hook-Cge6LiTK.js.map → hook-CqpVYDqN.js.map} +1 -1
  117. package/lib/index-Bt7MKhZq.js +2514 -0
  118. package/lib/index-Bt7MKhZq.js.map +1 -0
  119. package/lib/{index-B0y3fTg-.js → index-CjPMxpOV.js} +771 -730
  120. package/lib/index-CjPMxpOV.js.map +1 -0
  121. package/lib/{mutation-EChriCeF.js → mutation-8LjrN7uz.js} +2 -2
  122. package/lib/{mutation-EChriCeF.js.map → mutation-8LjrN7uz.js.map} +1 -1
  123. package/lib/ui/Command.js +1 -1
  124. package/lib/zudoku.auth-auth0.js +1 -1
  125. package/lib/zudoku.auth-clerk.js +2 -2
  126. package/lib/zudoku.auth-openid.js +2 -2
  127. package/lib/zudoku.components.js +31 -1454
  128. package/lib/zudoku.components.js.map +1 -1
  129. package/lib/zudoku.hooks.js +1 -1
  130. package/lib/zudoku.plugin-api-catalog.js +80 -77
  131. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  132. package/lib/zudoku.plugin-api-keys.js +3 -3
  133. package/lib/zudoku.plugin-custom-pages.js +1 -1
  134. package/lib/zudoku.plugin-markdown.js +1 -1
  135. package/lib/zudoku.plugin-openapi.js +2 -2
  136. package/lib/zudoku.plugin-search-pagefind.js +3 -3
  137. package/package.json +4 -3
  138. package/src/app/tailwind.ts +14 -0
  139. package/src/lib/components/Layout.tsx +4 -16
  140. package/src/lib/components/Main.tsx +3 -1
  141. package/src/lib/components/Pagination.tsx +47 -0
  142. package/src/lib/components/TopNavigation.tsx +29 -2
  143. package/src/lib/components/navigation/SidebarItem.tsx +10 -4
  144. package/src/lib/{plugins/markdown → components/navigation}/Toc.tsx +5 -14
  145. package/src/lib/oas/graphql/index.ts +118 -45
  146. package/src/lib/oas/parser/dereference/index.ts +2 -0
  147. package/src/lib/oas/parser/index.ts +7 -29
  148. package/src/lib/plugins/api-catalog/index.tsx +40 -35
  149. package/src/lib/plugins/markdown/MdxPage.tsx +6 -36
  150. package/src/lib/plugins/openapi/ColorizedParam.tsx +1 -1
  151. package/src/lib/plugins/openapi/OperationList.tsx +36 -15
  152. package/src/lib/plugins/openapi/OperationListItem.tsx +7 -2
  153. package/src/lib/plugins/openapi/ParameterListItem.tsx +2 -0
  154. package/src/lib/plugins/openapi/SchemaList.tsx +151 -0
  155. package/src/lib/plugins/openapi/client/GraphQLClient.tsx +1 -1
  156. package/src/lib/plugins/openapi/client/useCreateQuery.ts +12 -5
  157. package/src/lib/plugins/openapi/components/EnumValues.tsx +1 -1
  158. package/src/lib/plugins/openapi/graphql/gql.ts +15 -6
  159. package/src/lib/plugins/openapi/graphql/graphql.ts +104 -15
  160. package/src/lib/plugins/openapi/index.tsx +13 -0
  161. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.tsx +1 -8
  162. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.tsx +1 -2
  163. package/src/lib/plugins/openapi/schema/SchemaExampleAndDefault.tsx +36 -0
  164. package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +20 -21
  165. package/src/lib/plugins/openapi/schema/SchemaView.tsx +69 -141
  166. package/src/lib/plugins/openapi/schema/utils.ts +7 -1
  167. package/src/lib/plugins/openapi/util/getRoutes.tsx +9 -6
  168. package/src/lib/util/useOnScreen.ts +6 -4
  169. package/dist/lib/plugins/markdown/Toc.js.map +0 -1
  170. package/lib/MdxPage-JEdbfW-f.js +0 -195
  171. package/lib/MdxPage-JEdbfW-f.js.map +0 -1
  172. package/lib/OperationList-yOmYzMIp.js +0 -5379
  173. package/lib/OperationList-yOmYzMIp.js.map +0 -1
  174. package/lib/index-B0y3fTg-.js.map +0 -1
  175. package/lib/index.esm-CltAN0Tf.js +0 -711
  176. package/lib/index.esm-CltAN0Tf.js.map +0 -1
  177. /package/dist/lib/{plugins/markdown → components/navigation}/Toc.d.ts +0 -0
@@ -1,6 +1,7 @@
1
1
  import * as Collapsible from "@radix-ui/react-collapsible";
2
2
  import { MinusIcon, PlusIcon, RefreshCcwDotIcon } from "lucide-react";
3
3
  import { useCallback, useState } from "react";
4
+ import { InlineCode } from "../../../components/InlineCode.js";
4
5
  import { Markdown, ProseClasses } from "../../../components/Markdown.js";
5
6
  import type { SchemaObject } from "../../../oas/parser/index.js";
6
7
  import { Button } from "../../../ui/Button.js";
@@ -10,6 +11,7 @@ import { EnumValues } from "../components/EnumValues.js";
10
11
  import { SelectOnClick } from "../components/SelectOnClick.js";
11
12
  import { ParamInfos } from "../ParamInfos.js";
12
13
  import { LogicalGroup } from "./LogicalGroup/LogicalGroup.js";
14
+ import { SchemaExampleAndDefault } from "./SchemaExampleAndDefault.js";
13
15
  import { SchemaView } from "./SchemaView.js";
14
16
  import {
15
17
  hasLogicalGroupings,
@@ -18,13 +20,7 @@ import {
18
20
  LogicalSchemaTypeMap,
19
21
  } from "./utils.js";
20
22
 
21
- export const SchemaLogicalGroup = ({
22
- schema,
23
- level,
24
- }: {
25
- schema: SchemaObject;
26
- level: number;
27
- }) => {
23
+ export const SchemaLogicalGroup = ({ schema }: { schema: SchemaObject }) => {
28
24
  const [isOpen, setIsOpen] = useState(true);
29
25
  const toggleOpen = useCallback(() => setIsOpen((prev) => !prev), []);
30
26
 
@@ -37,31 +33,31 @@ export const SchemaLogicalGroup = ({
37
33
  type={type}
38
34
  isOpen={isOpen}
39
35
  toggleOpen={toggleOpen}
40
- level={level}
41
36
  />
42
37
  );
43
38
  }
44
39
  };
45
40
 
46
41
  const RecursiveIndicator = () => (
47
- <div className="flex items-center gap-1.5 italic text-xs text-muted-foreground font-mono bg-muted px-2 py-0.5 rounded-md">
42
+ <InlineCode
43
+ className="inline-flex items-center gap-1.5 italic text-xs translate-y-0.5"
44
+ selectOnClick={false}
45
+ >
48
46
  <RefreshCcwDotIcon size={13} />
49
47
  <span>circular</span>
50
- </div>
48
+ </InlineCode>
51
49
  );
52
50
 
53
51
  export const SchemaPropertyItem = ({
54
52
  name,
55
53
  schema,
56
54
  group,
57
- level,
58
55
  defaultOpen = false,
59
56
  showCollapseButton = true,
60
57
  }: {
61
58
  name: string;
62
59
  schema: SchemaObject;
63
60
  group: "required" | "optional" | "deprecated";
64
- level: number;
65
61
  defaultOpen?: boolean;
66
62
  showCollapseButton?: boolean;
67
63
  }) => {
@@ -73,9 +69,12 @@ export const SchemaPropertyItem = ({
73
69
  <div className="flex flex-col gap-2.5 justify-between text-sm">
74
70
  <div className="space-x-2">
75
71
  <code>{name}</code>
76
- <ParamInfos schema={schema} />
77
- <RecursiveIndicator />
72
+ <ParamInfos
73
+ schema={schema}
74
+ extraItems={[<RecursiveIndicator key="circular-ref" />]}
75
+ />
78
76
  </div>
77
+ <SchemaExampleAndDefault schema={schema} />
79
78
  </div>
80
79
  </li>
81
80
  );
@@ -94,11 +93,11 @@ export const SchemaPropertyItem = ({
94
93
  group !== "optional" && (
95
94
  <span className="text-primary">required</span>
96
95
  ),
96
+ schema.type === "array" &&
97
+ "items" in schema &&
98
+ isCircularRef(schema.items) && <RecursiveIndicator />,
97
99
  ]}
98
100
  />
99
- {schema.type === "array" &&
100
- "items" in schema &&
101
- isCircularRef(schema.items) && <RecursiveIndicator />}
102
101
  </div>
103
102
  {schema.description && (
104
103
  <Markdown
@@ -110,7 +109,7 @@ export const SchemaPropertyItem = ({
110
109
  <EnumValues values={schema.items.enum} />
111
110
  )}
112
111
  {schema.enum && <EnumValues values={schema.enum} />}
113
-
112
+ <SchemaExampleAndDefault schema={schema} />
114
113
  {(hasLogicalGroupings(schema) || isComplexType(schema)) && (
115
114
  <Collapsible.Root
116
115
  defaultOpen={defaultOpen}
@@ -128,15 +127,15 @@ export const SchemaPropertyItem = ({
128
127
  <Collapsible.Content>
129
128
  <div className="mt-2">
130
129
  {hasLogicalGroupings(schema) ? (
131
- <SchemaLogicalGroup schema={schema} level={level + 1} />
130
+ <SchemaLogicalGroup schema={schema} />
132
131
  ) : schema.type === "object" ? (
133
- <SchemaView schema={schema} level={level + 1} />
132
+ <SchemaView schema={schema} />
134
133
  ) : (
135
134
  schema.type === "array" &&
136
135
  "items" in schema &&
137
136
  typeof schema.items === "object" &&
138
137
  !isCircularRef(schema.items) && (
139
- <SchemaView schema={schema.items} level={level + 1} />
138
+ <SchemaView schema={schema.items} />
140
139
  )
141
140
  )}
142
141
  </div>
@@ -5,11 +5,12 @@ import { cn } from "../../../util/cn.js";
5
5
  import { groupBy } from "../../../util/groupBy.js";
6
6
  import { EnumValues } from "../components/EnumValues.js";
7
7
  import { ParamInfos } from "../ParamInfos.js";
8
+ import { SchemaExampleAndDefault } from "./SchemaExampleAndDefault.js";
8
9
  import {
9
10
  SchemaLogicalGroup,
10
11
  SchemaPropertyItem,
11
12
  } from "./SchemaPropertyItem.js";
12
- import { hasLogicalGroupings } from "./utils.js";
13
+ import { hasLogicalGroupings, isBasicType } from "./utils.js";
13
14
 
14
15
  const renderMarkdown = (content?: string) =>
15
16
  content && (
@@ -19,166 +20,93 @@ const renderMarkdown = (content?: string) =>
19
20
  />
20
21
  );
21
22
 
23
+ const renderBasicSchema = (schema: SchemaObject) => (
24
+ <Card className="p-4 space-y-2">
25
+ <span className="text-sm text-muted-foreground">
26
+ <ParamInfos schema={schema} />
27
+ </span>
28
+ {schema.enum && <EnumValues values={schema.enum} />}
29
+ {renderMarkdown(schema.description)}
30
+ <SchemaExampleAndDefault schema={schema} />
31
+ </Card>
32
+ );
33
+
22
34
  export const SchemaView = ({
23
35
  schema,
24
- level = 0,
25
36
  defaultOpen = false,
26
37
  }: {
27
38
  schema?: SchemaObject | null;
28
- level?: number;
29
39
  defaultOpen?: boolean;
30
40
  }) => {
31
41
  if (!schema || Object.keys(schema).length === 0) {
32
42
  return (
33
43
  <Card className="p-4">
34
44
  <span className="text-sm text-muted-foreground italic">
35
- No response specified
45
+ No schema specified
36
46
  </span>
37
47
  </Card>
38
48
  );
39
49
  }
40
50
 
41
- const renderSchema = (schema: SchemaObject, level: number) => {
42
- if (hasLogicalGroupings(schema)) {
43
- return <SchemaLogicalGroup schema={schema} level={level} />;
44
- }
45
-
46
- if (Array.isArray(schema.type)) {
47
- return (
48
- <Card className="p-4 space-y-2">
49
- <span className="text-sm text-muted-foreground">
50
- <ParamInfos schema={schema} />
51
- </span>
52
- {schema.enum && <EnumValues values={schema.enum} />}
53
- {renderMarkdown(schema.description)}
54
- </Card>
55
- );
56
- }
57
-
58
- if (schema.type === "array" && typeof schema.items === "object") {
59
- const itemsSchema = schema.items as SchemaObject;
60
-
61
- if (itemsSchema.enum) {
62
- return (
63
- <Card className="p-4">
64
- <span className="text-sm text-muted-foreground">
65
- <ParamInfos schema={schema} />
66
- </span>
67
- <EnumValues values={itemsSchema.enum} />
68
- {renderMarkdown(schema.description)}
69
- </Card>
70
- );
71
- }
72
-
73
- if (
74
- typeof itemsSchema.type === "string" &&
75
- ["string", "number", "boolean", "integer"].includes(itemsSchema.type)
76
- ) {
77
- return (
78
- <Card className="p-4">
79
- <span className="text-sm text-muted-foreground">
80
- <ParamInfos schema={schema} />
81
- </span>
82
- {renderMarkdown(schema.description)}
83
- </Card>
84
- );
85
- } else if (itemsSchema.type === "object") {
86
- return (
87
- <Card className="flex flex-col gap-2 bg-border/30 p-4">
88
- <span className="text-sm text-muted-foreground">object[]</span>
89
- {renderSchema(itemsSchema, level + 1)}
90
- </Card>
91
- );
92
- } else {
93
- return renderSchema(itemsSchema, level + 1);
94
- }
95
- }
96
-
97
- if (
98
- schema.type === "object" &&
99
- (!schema.properties || Object.keys(schema.properties).length === 0)
100
- ) {
101
- return (
102
- <Card className="p-4 flex gap-2 items-baseline">
103
- {"name" in schema && <>{schema.name as string}</>}
104
- <span className="text-sm text-muted-foreground">
105
- <ParamInfos schema={schema} />
106
- </span>
107
- {renderMarkdown(schema.description)}
108
- </Card>
109
- );
110
- }
111
-
112
- if (schema.properties) {
113
- const groupedProperties = groupBy(
114
- Object.entries(schema.properties),
115
- ([propertyName, property]) => {
116
- return property.deprecated
117
- ? "deprecated"
118
- : schema.required?.includes(propertyName)
119
- ? "required"
120
- : "optional";
121
- },
122
- );
51
+ if (hasLogicalGroupings(schema)) {
52
+ return <SchemaLogicalGroup schema={schema} />;
53
+ }
123
54
 
124
- const groupNames = ["required", "optional", "deprecated"] as const;
55
+ if (isBasicType(schema.type)) {
56
+ return renderBasicSchema(schema);
57
+ }
125
58
 
126
- return (
127
- <Card className="divide-y overflow-hidden">
128
- {groupNames.map(
129
- (group) =>
130
- groupedProperties[group] && (
131
- <ul key={group} className="divide-y">
132
- {groupedProperties[group].map(([name, schema]) => (
133
- <SchemaPropertyItem
134
- key={name}
135
- name={name}
136
- schema={schema}
137
- group={group}
138
- level={level}
139
- defaultOpen={defaultOpen}
140
- />
141
- ))}
142
- </ul>
143
- ),
144
- )}
145
- </Card>
146
- );
147
- }
59
+ if (schema.type === "array" && typeof schema.items === "object") {
60
+ return renderBasicSchema(schema.items as SchemaObject);
61
+ }
148
62
 
149
- if (
150
- typeof schema.type === "string" &&
151
- ["string", "number", "boolean", "integer", "null"].includes(schema.type)
152
- ) {
153
- return (
154
- <Card className="p-4 space-y-2">
155
- <span className="text-sm text-muted-foreground">
156
- <ParamInfos schema={schema} />
157
- </span>
158
- {schema.enum && <EnumValues values={schema.enum} />}
159
- {renderMarkdown(schema.description)}
160
- </Card>
161
- );
162
- }
63
+ if (schema.type === "object") {
64
+ const groupedProperties = groupBy(
65
+ Object.entries(schema.properties ?? {}),
66
+ ([propertyName, property]) => {
67
+ return property.deprecated
68
+ ? "deprecated"
69
+ : schema.required?.includes(propertyName)
70
+ ? "required"
71
+ : "optional";
72
+ },
73
+ );
74
+ const groupNames = ["required", "optional", "deprecated"] as const;
163
75
 
164
- if (schema.additionalProperties) {
165
- return (
166
- <Card className="my-2">
167
- <CardHeader>
168
- <CardTitle>Additional Properties:</CardTitle>
169
- </CardHeader>
170
- <CardContent>
171
- {renderSchema(
172
- schema.additionalProperties as SchemaObject,
173
- level + 1,
174
- )}
175
- </CardContent>
176
- </Card>
177
- );
178
- }
76
+ return (
77
+ <Card className="divide-y overflow-hidden">
78
+ {groupNames.map(
79
+ (group) =>
80
+ groupedProperties[group] && (
81
+ <ul key={group} className="divide-y">
82
+ {groupedProperties[group].map(([name, schema]) => (
83
+ <SchemaPropertyItem
84
+ key={name}
85
+ name={name}
86
+ schema={schema}
87
+ group={group}
88
+ defaultOpen={defaultOpen}
89
+ />
90
+ ))}
91
+ </ul>
92
+ ),
93
+ )}
94
+ </Card>
95
+ );
96
+ }
179
97
 
180
- return null;
181
- };
98
+ if (schema.additionalProperties) {
99
+ return (
100
+ <Card className="my-2">
101
+ <CardHeader>
102
+ <CardTitle>Additional Properties:</CardTitle>
103
+ </CardHeader>
104
+ <CardContent>
105
+ <SchemaView schema={schema.additionalProperties as SchemaObject} />
106
+ </CardContent>
107
+ </Card>
108
+ );
109
+ }
182
110
 
183
- return renderSchema(schema, level);
111
+ return null;
184
112
  };
@@ -1,8 +1,14 @@
1
1
  import { CIRCULAR_REF } from "../../../oas/graphql/circular.js";
2
2
  import type { SchemaObject } from "../../../oas/parser/index.js";
3
3
 
4
+ export const isBasicType = (
5
+ type: unknown,
6
+ ): type is "string" | "number" | "boolean" | "integer" | "null" =>
7
+ typeof type === "string" &&
8
+ ["string", "number", "boolean", "integer", "null"].includes(type);
9
+
4
10
  export const isComplexType = (value: SchemaObject) =>
5
- value.type === "object" ||
11
+ (value.type === "object" && Object.keys(value.properties ?? {}).length > 0) ||
6
12
  (value.type === "array" &&
7
13
  typeof value.items === "object" &&
8
14
  (!value.items.type || value.items.type === "object"));
@@ -1,4 +1,3 @@
1
- import slugify from "@sindresorhus/slugify";
2
1
  import { redirect, type RouteObject } from "react-router";
3
2
  import { joinUrl } from "../../../util/joinUrl.js";
4
3
  import type { GraphQLClient } from "../client/GraphQLClient.js";
@@ -53,10 +52,7 @@ const createVersionRoutes = (
53
52
  versionPath: string,
54
53
  tagPages: string[],
55
54
  ): RouteObject[] => {
56
- const firstTagRoute = joinUrl(
57
- versionPath,
58
- tagPages[0] ? slugify(tagPages[0]) : UNTAGGED_PATH,
59
- );
55
+ const firstTagRoute = joinUrl(versionPath, tagPages.at(0) ?? UNTAGGED_PATH);
60
56
 
61
57
  return [
62
58
  // Redirect to first tag on the index route
@@ -64,7 +60,7 @@ const createVersionRoutes = (
64
60
  // Create routes for each tag
65
61
  ...tagPages.map((tag) =>
66
62
  createRoute({
67
- path: joinUrl(versionPath, slugify(tag)),
63
+ path: joinUrl(versionPath, tag),
68
64
  tag,
69
65
  }),
70
66
  ),
@@ -73,6 +69,13 @@ const createVersionRoutes = (
73
69
  path: joinUrl(versionPath, UNTAGGED_PATH),
74
70
  untagged: true,
75
71
  }),
72
+ {
73
+ path: joinUrl(versionPath, "~schemas"),
74
+ lazy: async () => {
75
+ const { SchemaList } = await import("../SchemaList.js");
76
+ return { element: <SchemaList /> };
77
+ },
78
+ },
76
79
  ];
77
80
  };
78
81
 
@@ -1,14 +1,16 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
2
 
3
- export const useOnScreen = ({
3
+ export const useOnScreen = <E extends Element = HTMLElement>({
4
4
  rootMargin = "0px",
5
5
  threshold,
6
+ root,
6
7
  }: {
7
8
  rootMargin?: string;
8
9
  threshold?: number;
10
+ root?: Element | null;
9
11
  } = {}) => {
10
12
  const [isVisible, setIsVisible] = useState(false);
11
- const ref = useRef<HTMLElement | null>(null);
13
+ const ref = useRef<E | null>(null);
12
14
 
13
15
  useEffect(() => {
14
16
  const observer = new IntersectionObserver(
@@ -16,7 +18,7 @@ export const useOnScreen = ({
16
18
  if (!entry) return;
17
19
  setIsVisible(entry.isIntersecting);
18
20
  },
19
- { rootMargin, threshold },
21
+ { rootMargin, threshold, root },
20
22
  );
21
23
 
22
24
  const currentElement = ref.current;
@@ -26,7 +28,7 @@ export const useOnScreen = ({
26
28
  observer.observe(currentElement);
27
29
 
28
30
  return () => observer.unobserve(currentElement);
29
- }, [rootMargin, threshold]);
31
+ }, [root, rootMargin, threshold]);
30
32
 
31
33
  return [ref, isVisible] as const;
32
34
  };
@@ -1 +0,0 @@
1
- {"version":3,"file":"Toc.js","sourceRoot":"","sources":["../../../../src/lib/plugins/markdown/Toc.tsx"],"names":[],"mappings":"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"}
@@ -1,195 +0,0 @@
1
- import { j as e } from "./jsx-runtime-CYK1ROHF.js";
2
- import { s as C } from "./index-LNp6rxyU.js";
3
- import { H as E, u as P } from "./index.esm-CltAN0Tf.js";
4
- import { useRef as v, useState as _, useEffect as N } from "react";
5
- import { L as y } from "./chunk-HA7DTUK3-C4gP41vD.js";
6
- import { C as H } from "./CategoryHeading-DpB47wvk.js";
7
- import { u as I, A as S, H as h, P as L } from "./Markdown-DIZ8nBVC.js";
8
- import { e as $, f as D } from "./hook-Cge6LiTK.js";
9
- import { c as p } from "./cn-qaFjX9_3.js";
10
- import { ListTreeIcon as M } from "lucide-react";
11
- const w = "data-active", b = ({
12
- item: r,
13
- children: t,
14
- className: a,
15
- isActive: s
16
- }) => /* @__PURE__ */ e.jsxs(
17
- "li",
18
- {
19
- className: p(
20
- "truncate",
21
- s ? "text-primary" : "text-foreground/65 dark:text-foreground/75",
22
- a
23
- ),
24
- title: r.value,
25
- children: [
26
- /* @__PURE__ */ e.jsx(
27
- S,
28
- {
29
- to: `#${r.id}`,
30
- [w]: r.id,
31
- className: p(
32
- s ? "text-primary" : "text-foreground/65 dark:text-foreground/75 hover:text-foreground"
33
- ),
34
- children: r.value
35
- }
36
- ),
37
- t
38
- ]
39
- }
40
- ), q = ({ entries: r }) => {
41
- const { activeAnchor: t } = I(), a = v(null), s = v(!1), [c, l] = _({
42
- top: 0,
43
- opacity: 0
44
- });
45
- return N(() => {
46
- if (!a.current) return;
47
- const n = a.current.querySelector(
48
- `[${w}='${t}']`
49
- );
50
- if (!n) {
51
- l({ top: 0, opacity: 0 });
52
- return;
53
- }
54
- const o = a.current.getBoundingClientRect().top, d = n.getBoundingClientRect().top;
55
- l({
56
- opacity: 1,
57
- top: `${d - o}px`
58
- }), !s.current && requestIdleCallback(() => {
59
- s.current = !0;
60
- });
61
- }, [t]), /* @__PURE__ */ e.jsxs("aside", { className: "sticky scrollbar top-[--header-height] h-[calc(100vh-var(--header-height))] pt-[--padding-content-top] pb-[--padding-content-bottom] overflow-y-auto ps-1 text-sm", children: [
62
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 font-medium mb-2", children: [
63
- /* @__PURE__ */ e.jsx(M, { size: 16 }),
64
- "On this page"
65
- ] }),
66
- /* @__PURE__ */ e.jsxs("div", { className: "relative ms-2 ps-4", children: [
67
- /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 right-auto bg-border w-[2px]" }),
68
- /* @__PURE__ */ e.jsx(
69
- "div",
70
- {
71
- className: p(
72
- "absolute -left-px -translate-y-1 h-6 w-[4px] rounded bg-primary",
73
- s.current && "ease-out [transition:top_150ms,opacity_325ms]"
74
- ),
75
- style: c
76
- }
77
- ),
78
- /* @__PURE__ */ e.jsx(
79
- "ul",
80
- {
81
- ref: a,
82
- className: "relative font-medium list-none space-y-2",
83
- children: r.map((n) => /* @__PURE__ */ e.jsx(
84
- b,
85
- {
86
- isActive: n.id === t,
87
- item: n,
88
- className: "pl-0",
89
- children: n.children && /* @__PURE__ */ e.jsx("ul", { className: "list-none pl-4 pt-2 space-y-2", children: n.children.map((o) => /* @__PURE__ */ e.jsx(
90
- b,
91
- {
92
- item: o,
93
- isActive: o.id === t
94
- },
95
- o.id
96
- )) })
97
- },
98
- n.id
99
- ))
100
- }
101
- )
102
- ] })
103
- ] });
104
- }, B = {
105
- h2: ({ children: r, id: t }) => /* @__PURE__ */ e.jsx(h, { level: 2, id: t, registerSidebarAnchor: !0, children: r }),
106
- h3: ({ children: r, id: t }) => /* @__PURE__ */ e.jsx(h, { level: 3, id: t, registerSidebarAnchor: !0, children: r })
107
- }, Y = ({
108
- mdxComponent: r,
109
- file: t,
110
- frontmatter: a = {},
111
- defaultOptions: s,
112
- tableOfContents: c,
113
- excerpt: l
114
- }) => {
115
- var u, f, j;
116
- const n = (u = $()) == null ? void 0 : u.categoryLabel, o = a.title, d = a.category ?? n, k = a.toc === !1 || (s == null ? void 0 : s.toc) === !1, A = ((f = c.find((i) => i.depth === 1)) == null ? void 0 : f.value) ?? o, R = a.disablePager ?? (s == null ? void 0 : s.disablePager) ?? !1, g = ((j = c.find((i) => i.depth === 1)) == null ? void 0 : j.children) ?? // if `title` is provided by frontmatter it does not appear in the table of contents
117
- c.filter((i) => i.depth === 2), T = !k && g.length > 0, { prev: x, next: m } = D();
118
- return N(() => {
119
- if (process.env.NODE_ENV === "development")
120
- return window.__getReactRefreshIgnoredExports = ({ id: i }) => {
121
- if (i.endsWith(t))
122
- return ["frontmatter", "tableOfContents"];
123
- }, () => {
124
- window.__getReactRefreshIgnoredExports = void 0;
125
- };
126
- }, [t]), /* @__PURE__ */ e.jsxs(
127
- "div",
128
- {
129
- className: "grid grid-cols-1 xl:grid-cols-[--sidecar-grid-cols] gap-8 justify-between",
130
- "data-pagefind-filter": "section:markdown",
131
- "data-pagefind-meta": "section:markdown",
132
- children: [
133
- /* @__PURE__ */ e.jsxs(E, { children: [
134
- /* @__PURE__ */ e.jsx("title", { children: A }),
135
- l && /* @__PURE__ */ e.jsx("meta", { name: "description", content: l })
136
- ] }),
137
- /* @__PURE__ */ e.jsxs(
138
- "div",
139
- {
140
- className: p(
141
- L,
142
- "max-w-full xl:w-full xl:max-w-3xl flex-1 flex-shrink pt-[--padding-content-top] pb-[--padding-content-bottom]"
143
- ),
144
- children: [
145
- (d || o) && /* @__PURE__ */ e.jsxs("header", { children: [
146
- d && /* @__PURE__ */ e.jsx(H, { children: d }),
147
- o && /* @__PURE__ */ e.jsx(h, { level: 1, id: C(o), children: o })
148
- ] }),
149
- /* @__PURE__ */ e.jsx(
150
- r,
151
- {
152
- components: { ...P(), ...B }
153
- }
154
- ),
155
- !R && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
156
- /* @__PURE__ */ e.jsx("hr", {}),
157
- /* @__PURE__ */ e.jsxs("div", { className: "not-prose flex flex-wrap items-center justify-between gap-2 lg:gap-8", children: [
158
- x ? /* @__PURE__ */ e.jsxs(
159
- y,
160
- {
161
- to: x.id,
162
- className: "flex flex-col items-stretch gap-2 flex-1 min-w-max border rounded px-6 py-4 text-start hover:border-primary/85 transition shadow-sm hover:shadow-md",
163
- title: x.label,
164
- children: [
165
- /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: "← Previous page" }),
166
- /* @__PURE__ */ e.jsx("div", { className: "text-lg text-primary truncate", children: x.label })
167
- ]
168
- }
169
- ) : /* @__PURE__ */ e.jsx("div", { className: "flex-1" }),
170
- m ? /* @__PURE__ */ e.jsxs(
171
- y,
172
- {
173
- to: m.id,
174
- className: "flex flex-col items-stretch gap-2 flex-1 min-w-max border rounded px-6 py-4 text-end hover:border-primary/85 transition shadow-sm hover:shadow-md",
175
- title: m.label,
176
- children: [
177
- /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: "Next page →" }),
178
- /* @__PURE__ */ e.jsx("div", { className: "text-lg text-primary truncate", children: m.label })
179
- ]
180
- }
181
- ) : /* @__PURE__ */ e.jsx("div", { className: "flex-1" })
182
- ] })
183
- ] })
184
- ]
185
- }
186
- ),
187
- /* @__PURE__ */ e.jsx("div", { className: "hidden xl:block", children: T && /* @__PURE__ */ e.jsx(q, { entries: g }) })
188
- ]
189
- }
190
- );
191
- };
192
- export {
193
- Y as MdxPage
194
- };
195
- //# sourceMappingURL=MdxPage-JEdbfW-f.js.map