zudoku 0.0.0-e2f3304 → 0.0.0-e4b82fa
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.
- package/README.md +121 -0
- package/dist/app/main.js +5 -7
- package/dist/app/main.js.map +1 -1
- package/dist/cli/dev/handler.js +2 -2
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/config/validators/InputSidebarSchema.d.ts +19 -4
- package/dist/config/validators/InputSidebarSchema.js +7 -28
- package/dist/config/validators/InputSidebarSchema.js.map +1 -1
- package/dist/config/validators/SidebarSchema.js +5 -6
- package/dist/config/validators/SidebarSchema.js.map +1 -1
- package/dist/config/validators/validate.d.ts +55 -29
- package/dist/config/validators/validate.js +10 -2
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/lib/authentication/hook.d.ts +1 -1
- package/dist/lib/authentication/hook.js +1 -1
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/state.d.ts +16 -0
- package/dist/lib/authentication/state.js +5 -0
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/components/Banner.js +7 -1
- package/dist/lib/components/Banner.js.map +1 -1
- package/dist/lib/components/ErrorPage.js +1 -2
- package/dist/lib/components/ErrorPage.js.map +1 -1
- package/dist/lib/components/Header.js +1 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/InlineCode.d.ts +2 -1
- package/dist/lib/components/InlineCode.js +9 -1
- package/dist/lib/components/InlineCode.js.map +1 -1
- package/dist/lib/components/Layout.js +1 -1
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/MobileTopNavigation.js +5 -1
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/Search.js +1 -1
- package/dist/lib/components/Search.js.map +1 -1
- package/dist/lib/components/SlotletProvider.d.ts +9 -2
- package/dist/lib/components/SlotletProvider.js +4 -2
- package/dist/lib/components/SlotletProvider.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +3 -0
- package/dist/lib/components/TopNavigation.js +9 -1
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +2 -0
- package/dist/lib/components/index.d.ts +3 -1
- package/dist/lib/components/index.js +2 -0
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/Sidebar.js +1 -1
- package/dist/lib/components/navigation/Sidebar.js.map +1 -1
- package/dist/lib/components/navigation/SidebarCategory.js +18 -7
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
- package/dist/lib/components/navigation/SidebarItem.js +12 -5
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +2 -1
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/oas/graphql/index.d.ts +2 -1
- package/dist/lib/oas/graphql/index.js +23 -15
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/index.d.ts +1 -0
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/custom-pages/CustomPage.d.ts +2 -0
- package/dist/lib/plugins/custom-pages/CustomPage.js +11 -0
- package/dist/lib/plugins/custom-pages/CustomPage.js.map +1 -0
- package/dist/lib/plugins/custom-pages/index.d.ts +10 -0
- package/dist/lib/plugins/custom-pages/index.js +11 -0
- package/dist/lib/plugins/custom-pages/index.js.map +1 -0
- package/dist/lib/plugins/markdown/MdxPage.js +2 -2
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/openapi/Endpoint.d.ts +1 -3
- package/dist/lib/plugins/openapi/Endpoint.js +46 -8
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +2 -2
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.d.ts +2 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +2 -2
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -1
- package/dist/lib/plugins/openapi/Route.d.ts +1 -1
- package/dist/lib/plugins/openapi/Route.js +1 -1
- package/dist/lib/plugins/openapi/Route.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +15 -4
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SimpleSelect.d.ts +2 -1
- package/dist/lib/plugins/openapi/SimpleSelect.js +1 -1
- package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -1
- package/dist/lib/plugins/openapi/client/createMemoryClient.js +1 -1
- package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -1
- package/dist/lib/plugins/openapi/client/createWorkerClient.js +1 -1
- package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.d.ts +10 -2
- package/dist/lib/plugins/openapi/graphql/gql.js +2 -1
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +26 -0
- package/dist/lib/plugins/openapi/graphql/graphql.js +87 -0
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +1 -1
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +2 -1
- package/dist/lib/plugins/openapi/playground/Playground.js +14 -5
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/ResponseTab.js +1 -1
- package/dist/lib/plugins/openapi/playground/ResponseTab.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/createUrl.js +3 -1
- package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -1
- package/dist/lib/ui/Callout.d.ts +36 -35
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/ui/Drawer.d.ts +8 -10
- package/dist/lib/ui/Drawer.js.map +1 -1
- package/dist/lib/util/useExposedProps.d.ts +2 -0
- package/dist/lib/util/useExposedProps.js +8 -0
- package/dist/lib/util/useExposedProps.js.map +1 -0
- package/dist/vite/config.js +14 -12
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.d.ts +6 -1
- package/dist/vite/dev-server.js +13 -3
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/plugin-api.js +4 -7
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-component.js +0 -1
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-custom-pages.d.ts +4 -0
- package/dist/vite/plugin-custom-pages.js +30 -0
- package/dist/vite/plugin-custom-pages.js.map +1 -0
- package/dist/vite/plugin-frontmatter.d.ts +2 -0
- package/dist/vite/plugin-frontmatter.js +30 -0
- package/dist/vite/plugin-frontmatter.js.map +1 -0
- package/dist/vite/plugin-mdx.js +17 -0
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin-search.d.ts +3 -0
- package/dist/vite/plugin-search.js +26 -0
- package/dist/vite/plugin-search.js.map +1 -0
- package/dist/vite/plugin-sidebar.js +14 -1
- package/dist/vite/plugin-sidebar.js.map +1 -1
- package/dist/vite/plugin.js +6 -2
- package/dist/vite/plugin.js.map +1 -1
- package/lib/{AuthenticationPlugin-Bx9FK124.js → AuthenticationPlugin-D1nhROkO.js} +3 -3
- package/lib/{AuthenticationPlugin-Bx9FK124.js.map → AuthenticationPlugin-D1nhROkO.js.map} +1 -1
- package/lib/{CategoryHeading-XnFqN2lJ.js → CategoryHeading-B7TlPvuN.js} +2 -2
- package/lib/{CategoryHeading-XnFqN2lJ.js.map → CategoryHeading-B7TlPvuN.js.map} +1 -1
- package/lib/{DeveloperHint-FBb2uXJe.js → DeveloperHint-B_QCCafl.js} +2 -2
- package/lib/{DeveloperHint-FBb2uXJe.js.map → DeveloperHint-B_QCCafl.js.map} +1 -1
- package/lib/ErrorPage-DqqAV1dr.js +16 -0
- package/lib/ErrorPage-DqqAV1dr.js.map +1 -0
- package/lib/Input-DrR6P3mq.js +2229 -0
- package/lib/Input-DrR6P3mq.js.map +1 -0
- package/lib/{Markdown-B4aR03g6.js → Markdown-Y__eLG0x.js} +1448 -1286
- package/lib/Markdown-Y__eLG0x.js.map +1 -0
- package/lib/{MdxPage-BZyQsH8Z.js → MdxPage-B4FcPIi5.js} +25 -25
- package/lib/MdxPage-B4FcPIi5.js.map +1 -0
- package/lib/{OperationList-CCPePX04.js → OperationList-C2jKCTwZ.js} +149 -108
- package/lib/OperationList-C2jKCTwZ.js.map +1 -0
- package/lib/{Route-BAHaMyCu.js → Route-DWXcQzRK.js} +3 -4
- package/lib/Route-DWXcQzRK.js.map +1 -0
- package/lib/SidebarBadge-C0iWtji9.js +503 -0
- package/lib/SidebarBadge-C0iWtji9.js.map +1 -0
- package/lib/{SlotletProvider-DJMaOUDs.js → SlotletProvider-DmqWiVFt.js} +43 -42
- package/lib/{SlotletProvider-DJMaOUDs.js.map → SlotletProvider-DmqWiVFt.js.map} +1 -1
- package/lib/ZudokuContext-MRoel6bS.js +1173 -0
- package/lib/ZudokuContext-MRoel6bS.js.map +1 -0
- package/lib/assets/{index-B9EWVYfo.js → index-B_Jk_Yzp.js} +968 -938
- package/lib/assets/index-B_Jk_Yzp.js.map +1 -0
- package/lib/assets/{worker-TYRbYl6N.js → worker-Bf8vjASY.js} +6768 -4410
- package/lib/assets/worker-Bf8vjASY.js.map +1 -0
- package/lib/{index-CTNlSS40.js → index-Ch8VO_uX.js} +598 -545
- package/lib/index-Ch8VO_uX.js.map +1 -0
- package/lib/{index-CLd8ycZz.js → index-CkwDvuPt.js} +947 -917
- package/lib/index-CkwDvuPt.js.map +1 -0
- package/lib/index-D06ATMgg.js +2094 -0
- package/lib/index-D06ATMgg.js.map +1 -0
- package/lib/{index-BG0g4WW0.js → index-DFN92YJN.js} +748 -737
- package/lib/index-DFN92YJN.js.map +1 -0
- package/lib/index-DJqnphbT.js +35 -0
- package/lib/index-DJqnphbT.js.map +1 -0
- package/lib/{index-BOyE1gXD.js → index-Dso_b0di.js} +1970 -1690
- package/lib/index-Dso_b0di.js.map +1 -0
- package/lib/{index-WPT1ueCM.js → index-bYAqbdYl.js} +3 -3
- package/lib/{index-WPT1ueCM.js.map → index-bYAqbdYl.js.map} +1 -1
- package/lib/router-BsfSoK2j.js +3024 -0
- package/lib/router-BsfSoK2j.js.map +1 -0
- package/lib/state-CsuHT8ZO.js +183 -0
- package/lib/state-CsuHT8ZO.js.map +1 -0
- package/lib/urql-core-KJnLL26g.js +1455 -0
- package/lib/urql-core-KJnLL26g.js.map +1 -0
- package/lib/useExposedProps-BWwxa-Hg.js +9 -0
- package/lib/useExposedProps-BWwxa-Hg.js.map +1 -0
- package/lib/{utils-ByIc_KIM.js → utils-C8S3st2k.js} +4 -4
- package/lib/utils-C8S3st2k.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +363 -350
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +1768 -1687
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +4671 -4383
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +7 -7
- package/lib/zudoku.plugin-custom-pages.js +21 -0
- package/lib/zudoku.plugin-custom-pages.js.map +1 -0
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +8 -8
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/package.json +71 -69
- package/src/app/main.css +0 -1
- package/src/app/main.tsx +5 -7
- package/src/lib/authentication/hook.ts +1 -1
- package/src/lib/authentication/state.ts +17 -0
- package/src/lib/components/Banner.tsx +12 -2
- package/src/lib/components/ErrorPage.tsx +0 -2
- package/src/lib/components/Header.tsx +4 -2
- package/src/lib/components/InlineCode.tsx +10 -0
- package/src/lib/components/Layout.tsx +2 -1
- package/src/lib/components/MobileTopNavigation.tsx +10 -2
- package/src/lib/components/Search.tsx +1 -1
- package/src/lib/components/SlotletProvider.tsx +27 -4
- package/src/lib/components/TopNavigation.tsx +14 -1
- package/src/lib/components/index.ts +3 -1
- package/src/lib/components/navigation/Sidebar.tsx +1 -1
- package/src/lib/components/navigation/SidebarCategory.tsx +34 -26
- package/src/lib/components/navigation/SidebarItem.tsx +16 -17
- package/src/lib/core/DevPortalContext.ts +7 -2
- package/src/lib/oas/graphql/index.ts +35 -23
- package/src/lib/oas/parser/index.ts +1 -0
- package/src/lib/plugins/custom-pages/CustomPage.tsx +18 -0
- package/src/lib/plugins/custom-pages/index.tsx +24 -0
- package/src/lib/plugins/markdown/MdxPage.tsx +11 -9
- package/src/lib/plugins/openapi/Endpoint.tsx +86 -22
- package/src/lib/plugins/openapi/OperationList.tsx +4 -2
- package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +3 -0
- package/src/lib/plugins/openapi/Route.tsx +1 -2
- package/src/lib/plugins/openapi/Sidecar.tsx +18 -3
- package/src/lib/plugins/openapi/SimpleSelect.tsx +10 -2
- package/src/lib/plugins/openapi/client/createMemoryClient.ts +1 -6
- package/src/lib/plugins/openapi/client/createWorkerClient.ts +1 -6
- package/src/lib/plugins/openapi/graphql/gql.ts +11 -3
- package/src/lib/plugins/openapi/graphql/graphql.ts +113 -1
- package/src/lib/plugins/openapi/index.tsx +1 -5
- package/src/lib/plugins/openapi/playground/Playground.tsx +40 -5
- package/src/lib/plugins/openapi/playground/ResponseTab.tsx +0 -1
- package/src/lib/plugins/openapi/playground/createUrl.ts +6 -1
- package/src/lib/ui/Callout.tsx +7 -6
- package/src/lib/ui/Drawer.tsx +38 -36
- package/src/lib/util/useExposedProps.tsx +10 -0
- package/dist/lib/plugins/custom-page/index.d.ts +0 -8
- package/dist/lib/plugins/custom-page/index.js +0 -12
- package/dist/lib/plugins/custom-page/index.js.map +0 -1
- package/dist/lib/plugins/openapi/playground/Editor.d.ts +0 -1
- package/dist/lib/plugins/openapi/playground/Editor.js +0 -5
- package/dist/lib/plugins/openapi/playground/Editor.js.map +0 -1
- package/dist/lib/plugins/openapi/util/urql.d.ts +0 -7
- package/dist/lib/plugins/openapi/util/urql.js +0 -8
- package/dist/lib/plugins/openapi/util/urql.js.map +0 -1
- package/dist/lib/util/slugify.d.ts +0 -2
- package/dist/lib/util/slugify.js +0 -3
- package/dist/lib/util/slugify.js.map +0 -1
- package/dist/vite/plugin-icons.d.ts +0 -3
- package/dist/vite/plugin-icons.js +0 -47
- package/dist/vite/plugin-icons.js.map +0 -1
- package/lib/ErrorPage-knunPbKI.js +0 -18
- package/lib/ErrorPage-knunPbKI.js.map +0 -1
- package/lib/Input-BR5ia3Yq.js +0 -2198
- package/lib/Input-BR5ia3Yq.js.map +0 -1
- package/lib/Markdown-B4aR03g6.js.map +0 -1
- package/lib/MdxPage-BZyQsH8Z.js.map +0 -1
- package/lib/OperationList-CCPePX04.js.map +0 -1
- package/lib/Route-BAHaMyCu.js.map +0 -1
- package/lib/SidebarBadge-BaUICQiz.js +0 -498
- package/lib/SidebarBadge-BaUICQiz.js.map +0 -1
- package/lib/ZudokuContext-cr-pTRY1.js +0 -1084
- package/lib/ZudokuContext-cr-pTRY1.js.map +0 -1
- package/lib/_commonjsHelpers-BkfeUUK-.js +0 -29
- package/lib/_commonjsHelpers-BkfeUUK-.js.map +0 -1
- package/lib/assets/index-B9EWVYfo.js.map +0 -1
- package/lib/assets/worker-TYRbYl6N.js.map +0 -1
- package/lib/index-BG0g4WW0.js.map +0 -1
- package/lib/index-BOyE1gXD.js.map +0 -1
- package/lib/index-CLd8ycZz.js.map +0 -1
- package/lib/index-CTNlSS40.js.map +0 -1
- package/lib/router-D2p7Olpn.js +0 -2971
- package/lib/router-D2p7Olpn.js.map +0 -1
- package/lib/slugify-DbLhpSPt.js +0 -28
- package/lib/slugify-DbLhpSPt.js.map +0 -1
- package/lib/state-BUM4jc0J.js +0 -288
- package/lib/state-BUM4jc0J.js.map +0 -1
- package/lib/urql-YhcsXYy8.js +0 -1591
- package/lib/urql-YhcsXYy8.js.map +0 -1
- package/lib/utils-ByIc_KIM.js.map +0 -1
- package/lib/zudoku.plugin-custom-page.js +0 -13
- package/lib/zudoku.plugin-custom-page.js.map +0 -1
- package/src/lib/plugins/custom-page/index.tsx +0 -22
- package/src/lib/plugins/openapi/playground/Editor.tsx +0 -4
- package/src/lib/plugins/openapi/util/urql.ts +0 -8
- package/src/lib/util/slugify.ts +0 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { HTTPSnippet } from "@zudoku/httpsnippet";
|
|
2
2
|
import { Fragment, useMemo, useTransition } from "react";
|
|
3
3
|
import { useSearchParams } from "react-router-dom";
|
|
4
|
+
import { useQuery } from "urql";
|
|
5
|
+
import { useSelectedServerStore } from "../../authentication/state.js";
|
|
4
6
|
import { TextColorMap } from "../../components/navigation/SidebarBadge.js";
|
|
5
7
|
import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
|
|
6
8
|
import type { SchemaObject } from "../../oas/parser/index.js";
|
|
@@ -15,7 +17,6 @@ import { ResponsesSidecarBox } from "./ResponsesSidecarBox.js";
|
|
|
15
17
|
import * as SidecarBox from "./SidecarBox.js";
|
|
16
18
|
import { SimpleSelect } from "./SimpleSelect.js";
|
|
17
19
|
import { generateSchemaExample } from "./util/generateSchemaExample.js";
|
|
18
|
-
import { useQuery } from "./util/urql.js";
|
|
19
20
|
|
|
20
21
|
const getConverted = (snippet: HTTPSnippet, option: string) => {
|
|
21
22
|
let converted;
|
|
@@ -65,6 +66,9 @@ export const GetServerQuery = graphql(/* GraphQL */ `
|
|
|
65
66
|
query getServerQuery($input: JSON!, $type: SchemaType!) {
|
|
66
67
|
schema(input: $input, type: $type) {
|
|
67
68
|
url
|
|
69
|
+
servers {
|
|
70
|
+
url
|
|
71
|
+
}
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
`);
|
|
@@ -135,6 +139,8 @@ export const Sidecar = ({
|
|
|
135
139
|
);
|
|
136
140
|
});
|
|
137
141
|
|
|
142
|
+
const { selectedServer } = useSelectedServerStore();
|
|
143
|
+
|
|
138
144
|
const code = useMemo(() => {
|
|
139
145
|
const example = requestBodyContent?.[0]?.schema
|
|
140
146
|
? generateSchemaExample(requestBodyContent[0].schema as SchemaObject)
|
|
@@ -143,7 +149,7 @@ export const Sidecar = ({
|
|
|
143
149
|
const snippet = new HTTPSnippet({
|
|
144
150
|
method: operation.method.toLocaleUpperCase(),
|
|
145
151
|
url:
|
|
146
|
-
(result.data?.schema.url ?? "") +
|
|
152
|
+
(selectedServer ?? result.data?.schema.url ?? "") +
|
|
147
153
|
operation.path.replaceAll("{", ":").replaceAll("}", ""),
|
|
148
154
|
postData: example
|
|
149
155
|
? {
|
|
@@ -160,7 +166,13 @@ export const Sidecar = ({
|
|
|
160
166
|
});
|
|
161
167
|
|
|
162
168
|
return getConverted(snippet, selectedLang);
|
|
163
|
-
}, [
|
|
169
|
+
}, [
|
|
170
|
+
selectedServer,
|
|
171
|
+
selectedLang,
|
|
172
|
+
operation.method,
|
|
173
|
+
operation.path,
|
|
174
|
+
requestBodyContent,
|
|
175
|
+
]);
|
|
164
176
|
|
|
165
177
|
return (
|
|
166
178
|
<aside className="flex flex-col overflow-hidden sticky top-[--scroll-padding] gap-4">
|
|
@@ -175,6 +187,9 @@ export const Sidecar = ({
|
|
|
175
187
|
</span>
|
|
176
188
|
<PlaygroundDialogWrapper
|
|
177
189
|
server={result.data?.schema.url ?? ""}
|
|
190
|
+
servers={
|
|
191
|
+
result.data?.schema.servers.map((server) => server.url) ?? []
|
|
192
|
+
}
|
|
178
193
|
operation={operation}
|
|
179
194
|
/>
|
|
180
195
|
</SidecarBox.Head>
|
|
@@ -7,6 +7,7 @@ export const SimpleSelect = ({
|
|
|
7
7
|
onChange,
|
|
8
8
|
className,
|
|
9
9
|
options,
|
|
10
|
+
showChevrons = true,
|
|
10
11
|
}: {
|
|
11
12
|
value: string;
|
|
12
13
|
onChange: ChangeEventHandler<HTMLSelectElement>;
|
|
@@ -15,12 +16,14 @@ export const SimpleSelect = ({
|
|
|
15
16
|
value: string;
|
|
16
17
|
label: string;
|
|
17
18
|
}[];
|
|
19
|
+
showChevrons?: boolean;
|
|
18
20
|
}) => (
|
|
19
|
-
<div className=
|
|
21
|
+
<div className="grid">
|
|
20
22
|
<select
|
|
21
23
|
className={cn(
|
|
22
24
|
"row-start-1 col-start-1 border border-input text-foreground px-2 py-1 pe-6",
|
|
23
25
|
"rounded-md appearance-none bg-zinc-50 hover:bg-white dark:bg-zinc-800 hover:dark:bg-zinc-800/75",
|
|
26
|
+
className,
|
|
24
27
|
)}
|
|
25
28
|
value={value}
|
|
26
29
|
onChange={onChange}
|
|
@@ -31,7 +34,12 @@ export const SimpleSelect = ({
|
|
|
31
34
|
</option>
|
|
32
35
|
))}
|
|
33
36
|
</select>
|
|
34
|
-
<div
|
|
37
|
+
<div
|
|
38
|
+
className={cn(
|
|
39
|
+
!showChevrons && "hidden",
|
|
40
|
+
"row-start-1 col-start-1 self-center justify-self-end relative end-2 pointer-events-none",
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
35
43
|
<ChevronsUpDownIcon size={14} />
|
|
36
44
|
</div>
|
|
37
45
|
</div>
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import {
|
|
3
|
-
cacheExchange,
|
|
4
|
-
Client,
|
|
5
|
-
fetchExchange,
|
|
6
|
-
mapExchange,
|
|
7
|
-
} from "../util/urql.js";
|
|
2
|
+
import { cacheExchange, Client, fetchExchange, mapExchange } from "urql";
|
|
8
3
|
import { createServer } from "./createServer.js";
|
|
9
4
|
import { CreateClientFunction } from "./interfaces.js";
|
|
10
5
|
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { monotonicFactory } from "ulidx";
|
|
3
|
+
import { cacheExchange, Client, fetchExchange, mapExchange } from "urql";
|
|
3
4
|
import { createWaitForNotify } from "../../../util/createWaitForNotify.js";
|
|
4
|
-
import {
|
|
5
|
-
cacheExchange,
|
|
6
|
-
Client,
|
|
7
|
-
fetchExchange,
|
|
8
|
-
mapExchange,
|
|
9
|
-
} from "../util/urql.js";
|
|
10
5
|
import { createClient as createMemoryClient } from "./createMemoryClient.js";
|
|
11
6
|
import { CreateClientFunction } from "./interfaces.js";
|
|
12
7
|
|
|
@@ -13,11 +13,13 @@ import * as types from "./graphql.js";
|
|
|
13
13
|
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
14
14
|
*/
|
|
15
15
|
const documents = {
|
|
16
|
+
"\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
|
|
17
|
+
types.ServersQueryDocument,
|
|
16
18
|
"\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n parameters {\n name\n in\n description\n required\n schema\n style\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n":
|
|
17
19
|
types.OperationsFragmentFragmentDoc,
|
|
18
20
|
"\n query AllOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n description\n title\n url\n version\n tags {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n }\n }\n }\n":
|
|
19
21
|
types.AllOperationsDocument,
|
|
20
|
-
"\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n }\n }\n":
|
|
22
|
+
"\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
|
|
21
23
|
types.GetServerQueryDocument,
|
|
22
24
|
"\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n __typename\n name\n operations {\n __typename\n slug\n deprecated\n method\n summary\n operationId\n path\n }\n }\n }\n }\n":
|
|
23
25
|
types.GetCategoriesDocument,
|
|
@@ -37,6 +39,12 @@ const documents = {
|
|
|
37
39
|
*/
|
|
38
40
|
export function graphql(source: string): unknown;
|
|
39
41
|
|
|
42
|
+
/**
|
|
43
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
44
|
+
*/
|
|
45
|
+
export function graphql(
|
|
46
|
+
source: "\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n",
|
|
47
|
+
): (typeof documents)["\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n"];
|
|
40
48
|
/**
|
|
41
49
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
42
50
|
*/
|
|
@@ -53,8 +61,8 @@ export function graphql(
|
|
|
53
61
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
54
62
|
*/
|
|
55
63
|
export function graphql(
|
|
56
|
-
source: "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n }\n }\n",
|
|
57
|
-
): (typeof documents)["\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n }\n }\n"];
|
|
64
|
+
source: "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n",
|
|
65
|
+
): (typeof documents)["\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n"];
|
|
58
66
|
/**
|
|
59
67
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
60
68
|
*/
|
|
@@ -131,6 +131,7 @@ export type Schema = {
|
|
|
131
131
|
openapi: Scalars["String"]["output"];
|
|
132
132
|
operations: Array<OperationItem>;
|
|
133
133
|
paths: Array<PathItem>;
|
|
134
|
+
servers: Array<Server>;
|
|
134
135
|
tags: Array<SchemaTag>;
|
|
135
136
|
title: Scalars["String"]["output"];
|
|
136
137
|
url: Scalars["String"]["output"];
|
|
@@ -157,12 +158,32 @@ export type SchemaTag = {
|
|
|
157
158
|
|
|
158
159
|
export type SchemaType = "file" | "raw" | "url";
|
|
159
160
|
|
|
161
|
+
export type Server = {
|
|
162
|
+
__typename?: "Server";
|
|
163
|
+
description?: Maybe<Scalars["String"]["output"]>;
|
|
164
|
+
url: Scalars["String"]["output"];
|
|
165
|
+
};
|
|
166
|
+
|
|
160
167
|
export type TagItem = {
|
|
161
168
|
__typename?: "TagItem";
|
|
162
169
|
description?: Maybe<Scalars["String"]["output"]>;
|
|
163
170
|
name: Scalars["String"]["output"];
|
|
164
171
|
};
|
|
165
172
|
|
|
173
|
+
export type ServersQueryQueryVariables = Exact<{
|
|
174
|
+
input: Scalars["JSON"]["input"];
|
|
175
|
+
type: SchemaType;
|
|
176
|
+
}>;
|
|
177
|
+
|
|
178
|
+
export type ServersQueryQuery = {
|
|
179
|
+
__typename?: "Query";
|
|
180
|
+
schema: {
|
|
181
|
+
__typename?: "Schema";
|
|
182
|
+
url: string;
|
|
183
|
+
servers: Array<{ __typename?: "Server"; url: string }>;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
|
|
166
187
|
export type OperationsFragmentFragment = {
|
|
167
188
|
__typename?: "OperationItem";
|
|
168
189
|
slug: string;
|
|
@@ -249,7 +270,11 @@ export type GetServerQueryQueryVariables = Exact<{
|
|
|
249
270
|
|
|
250
271
|
export type GetServerQueryQuery = {
|
|
251
272
|
__typename?: "Query";
|
|
252
|
-
schema: {
|
|
273
|
+
schema: {
|
|
274
|
+
__typename?: "Schema";
|
|
275
|
+
url: string;
|
|
276
|
+
servers: Array<{ __typename?: "Server"; url: string }>;
|
|
277
|
+
};
|
|
253
278
|
};
|
|
254
279
|
|
|
255
280
|
export type GetCategoriesQueryVariables = Exact<{
|
|
@@ -423,6 +448,83 @@ export const OperationsFragmentFragmentDoc = {
|
|
|
423
448
|
},
|
|
424
449
|
],
|
|
425
450
|
} as unknown as DocumentNode<OperationsFragmentFragment, unknown>;
|
|
451
|
+
export const ServersQueryDocument = {
|
|
452
|
+
kind: "Document",
|
|
453
|
+
definitions: [
|
|
454
|
+
{
|
|
455
|
+
kind: "OperationDefinition",
|
|
456
|
+
operation: "query",
|
|
457
|
+
name: { kind: "Name", value: "ServersQuery" },
|
|
458
|
+
variableDefinitions: [
|
|
459
|
+
{
|
|
460
|
+
kind: "VariableDefinition",
|
|
461
|
+
variable: {
|
|
462
|
+
kind: "Variable",
|
|
463
|
+
name: { kind: "Name", value: "input" },
|
|
464
|
+
},
|
|
465
|
+
type: {
|
|
466
|
+
kind: "NonNullType",
|
|
467
|
+
type: { kind: "NamedType", name: { kind: "Name", value: "JSON" } },
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
kind: "VariableDefinition",
|
|
472
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "type" } },
|
|
473
|
+
type: {
|
|
474
|
+
kind: "NonNullType",
|
|
475
|
+
type: {
|
|
476
|
+
kind: "NamedType",
|
|
477
|
+
name: { kind: "Name", value: "SchemaType" },
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
],
|
|
482
|
+
selectionSet: {
|
|
483
|
+
kind: "SelectionSet",
|
|
484
|
+
selections: [
|
|
485
|
+
{
|
|
486
|
+
kind: "Field",
|
|
487
|
+
name: { kind: "Name", value: "schema" },
|
|
488
|
+
arguments: [
|
|
489
|
+
{
|
|
490
|
+
kind: "Argument",
|
|
491
|
+
name: { kind: "Name", value: "input" },
|
|
492
|
+
value: {
|
|
493
|
+
kind: "Variable",
|
|
494
|
+
name: { kind: "Name", value: "input" },
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
kind: "Argument",
|
|
499
|
+
name: { kind: "Name", value: "type" },
|
|
500
|
+
value: {
|
|
501
|
+
kind: "Variable",
|
|
502
|
+
name: { kind: "Name", value: "type" },
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
],
|
|
506
|
+
selectionSet: {
|
|
507
|
+
kind: "SelectionSet",
|
|
508
|
+
selections: [
|
|
509
|
+
{ kind: "Field", name: { kind: "Name", value: "url" } },
|
|
510
|
+
{
|
|
511
|
+
kind: "Field",
|
|
512
|
+
name: { kind: "Name", value: "servers" },
|
|
513
|
+
selectionSet: {
|
|
514
|
+
kind: "SelectionSet",
|
|
515
|
+
selections: [
|
|
516
|
+
{ kind: "Field", name: { kind: "Name", value: "url" } },
|
|
517
|
+
],
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
],
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
],
|
|
527
|
+
} as unknown as DocumentNode<ServersQueryQuery, ServersQueryQueryVariables>;
|
|
426
528
|
export const AllOperationsDocument = {
|
|
427
529
|
kind: "Document",
|
|
428
530
|
definitions: [
|
|
@@ -727,6 +829,16 @@ export const GetServerQueryDocument = {
|
|
|
727
829
|
kind: "SelectionSet",
|
|
728
830
|
selections: [
|
|
729
831
|
{ kind: "Field", name: { kind: "Name", value: "url" } },
|
|
832
|
+
{
|
|
833
|
+
kind: "Field",
|
|
834
|
+
name: { kind: "Name", value: "servers" },
|
|
835
|
+
selectionSet: {
|
|
836
|
+
kind: "SelectionSet",
|
|
837
|
+
selections: [
|
|
838
|
+
{ kind: "Field", name: { kind: "Name", value: "url" } },
|
|
839
|
+
],
|
|
840
|
+
},
|
|
841
|
+
},
|
|
730
842
|
],
|
|
731
843
|
},
|
|
732
844
|
},
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { matchPath, useRouteError, type RouteObject } from "react-router-dom";
|
|
2
|
+
import { Client as UrqlClient, cacheExchange, fetchExchange } from "urql";
|
|
2
3
|
import { type DevPortalPlugin } from "../../core/plugins.js";
|
|
3
4
|
import { graphql } from "./graphql/index.js";
|
|
4
|
-
import {
|
|
5
|
-
Client as UrqlClient,
|
|
6
|
-
cacheExchange,
|
|
7
|
-
fetchExchange,
|
|
8
|
-
} from "./util/urql.js";
|
|
9
5
|
|
|
10
6
|
import { useQuery } from "@tanstack/react-query";
|
|
11
7
|
import { CirclePlayIcon, LogInIcon } from "lucide-react";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
|
-
import { Fragment, useEffect, useRef } from "react";
|
|
2
|
+
import { Fragment, useEffect, useRef, useTransition } from "react";
|
|
3
3
|
import { FormProvider, useForm } from "react-hook-form";
|
|
4
|
+
import { useSelectedServerStore } from "../../../authentication/state.js";
|
|
4
5
|
import { useApiIdentities } from "../../../components/context/ZudokuContext.js";
|
|
5
6
|
import {
|
|
6
7
|
Select,
|
|
@@ -62,6 +63,7 @@ export type PlaygroundForm = {
|
|
|
62
63
|
|
|
63
64
|
export type PlaygroundContentProps = {
|
|
64
65
|
server: string;
|
|
66
|
+
servers?: string[];
|
|
65
67
|
url: string;
|
|
66
68
|
method: string;
|
|
67
69
|
headers?: Header[];
|
|
@@ -72,6 +74,7 @@ export type PlaygroundContentProps = {
|
|
|
72
74
|
|
|
73
75
|
export const Playground = ({
|
|
74
76
|
server,
|
|
77
|
+
servers,
|
|
75
78
|
url,
|
|
76
79
|
method,
|
|
77
80
|
headers = [],
|
|
@@ -79,6 +82,8 @@ export const Playground = ({
|
|
|
79
82
|
pathParams = [],
|
|
80
83
|
defaultBody = "",
|
|
81
84
|
}: PlaygroundContentProps) => {
|
|
85
|
+
const { selectedServer, setSelectedServer } = useSelectedServerStore();
|
|
86
|
+
const [, startTransition] = useTransition();
|
|
82
87
|
const { register, control, handleSubmit, watch, setValue, ...form } =
|
|
83
88
|
useForm<PlaygroundForm>({
|
|
84
89
|
defaultValues: {
|
|
@@ -114,7 +119,7 @@ export const Playground = ({
|
|
|
114
119
|
|
|
115
120
|
const queryMutation = useMutation({
|
|
116
121
|
mutationFn: async (data: PlaygroundForm) => {
|
|
117
|
-
const requestUrl = createUrl(server, url, data);
|
|
122
|
+
const requestUrl = createUrl(selectedServer ?? server, url, data);
|
|
118
123
|
const start = performance.now();
|
|
119
124
|
|
|
120
125
|
const request = new Request(requestUrl, {
|
|
@@ -124,6 +129,7 @@ export const Playground = ({
|
|
|
124
129
|
.filter((h) => h.name)
|
|
125
130
|
.map((header) => [header.name, header.value]),
|
|
126
131
|
),
|
|
132
|
+
body: data.body ? data.body : undefined,
|
|
127
133
|
});
|
|
128
134
|
|
|
129
135
|
if (data.identity !== NO_IDENTITY) {
|
|
@@ -200,19 +206,48 @@ export const Playground = ({
|
|
|
200
206
|
</Fragment>
|
|
201
207
|
));
|
|
202
208
|
|
|
209
|
+
const serverSelect = (
|
|
210
|
+
<div className="inline-block opacity-50 hover:opacity-100 transition">
|
|
211
|
+
{servers && servers.length > 1 ? (
|
|
212
|
+
<Select
|
|
213
|
+
onValueChange={(value) => {
|
|
214
|
+
startTransition(() => {
|
|
215
|
+
setSelectedServer(value);
|
|
216
|
+
});
|
|
217
|
+
}}
|
|
218
|
+
value={selectedServer}
|
|
219
|
+
>
|
|
220
|
+
<SelectTrigger className="p-0 border-none flex-row-reverse bg-transparent text-xs gap-0.5 h-auto">
|
|
221
|
+
<SelectValue />
|
|
222
|
+
</SelectTrigger>
|
|
223
|
+
<SelectContent>
|
|
224
|
+
{servers.map((s) => (
|
|
225
|
+
<SelectItem key={s} value={s}>
|
|
226
|
+
{s.replace(/^https?:\/\//, "")}
|
|
227
|
+
</SelectItem>
|
|
228
|
+
))}
|
|
229
|
+
</SelectContent>
|
|
230
|
+
</Select>
|
|
231
|
+
) : (
|
|
232
|
+
<span>{server.replace(/^https?:\/\//, "")}</span>
|
|
233
|
+
)}
|
|
234
|
+
</div>
|
|
235
|
+
);
|
|
236
|
+
|
|
203
237
|
return (
|
|
204
238
|
<FormProvider
|
|
205
239
|
{...{ register, control, handleSubmit, watch, setValue, ...form }}
|
|
206
240
|
>
|
|
207
241
|
<form onSubmit={handleSubmit((data) => queryMutation.mutateAsync(data))}>
|
|
208
|
-
<div className="grid grid-cols-
|
|
242
|
+
<div className="grid grid-cols-[8fr_7fr] text-sm h-full">
|
|
209
243
|
<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">
|
|
210
244
|
<div className="flex gap-2 items-stretch">
|
|
211
245
|
<div className="flex flex-1 items-center w-full border rounded-md">
|
|
212
246
|
<div className="border-r p-2 bg-muted rounded-l-md self-stretch font-semibold font-mono">
|
|
213
247
|
{method.toUpperCase()}
|
|
214
248
|
</div>
|
|
215
|
-
<div className="p-2 font-mono text-xs">
|
|
249
|
+
<div className="flex items-center flex-wrap p-2 font-mono text-xs">
|
|
250
|
+
{serverSelect}
|
|
216
251
|
{path}
|
|
217
252
|
{urlQueryParams.length > 0 ? "?" : ""}
|
|
218
253
|
{urlQueryParams}
|
|
@@ -296,7 +331,7 @@ export const Playground = ({
|
|
|
296
331
|
</TabsContent>
|
|
297
332
|
</Tabs>
|
|
298
333
|
</div>
|
|
299
|
-
<div className="p-8 bg-muted/70">
|
|
334
|
+
<div className="min-w-0 p-8 bg-muted/70">
|
|
300
335
|
{queryMutation.error ? (
|
|
301
336
|
<div className="flex flex-col gap-2">
|
|
302
337
|
{formState.pathParams.some((p) => p.value === "") && (
|
|
@@ -54,7 +54,6 @@ export const ResponseTab = ({
|
|
|
54
54
|
view === "raw" ? (jsonContent ? "plain" : detectedLanguage) : "json"
|
|
55
55
|
}
|
|
56
56
|
noBackground
|
|
57
|
-
showLanguageIndicator
|
|
58
57
|
// playground dialog has h-5/6 ≈ 83.333vh
|
|
59
58
|
className="overflow-x-auto p-4 text-xs max-h-[calc(83.333vh-180px)]"
|
|
60
59
|
code={view === "raw" ? body : beautifiedBody}
|
|
@@ -8,7 +8,12 @@ export const createUrl = (host: string, path: string, data: PlaygroundForm) => {
|
|
|
8
8
|
return value ?? match;
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// Ensure host ends with a slash and path doesn't start with one,
|
|
12
|
+
// so they form a correct URL, without overriding the host's path.
|
|
13
|
+
const url = new URL(
|
|
14
|
+
filledPath.replace(/^\//, ""),
|
|
15
|
+
host.endsWith("/") ? host : `${host}/`,
|
|
16
|
+
);
|
|
12
17
|
|
|
13
18
|
data.queryParams
|
|
14
19
|
.filter((param) => param.active)
|
package/src/lib/ui/Callout.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
AlertTriangleIcon,
|
|
3
3
|
InfoIcon,
|
|
4
4
|
LightbulbIcon,
|
|
5
|
+
type LucideIcon,
|
|
5
6
|
ShieldAlertIcon,
|
|
6
7
|
} from "lucide-react";
|
|
7
8
|
import type { ReactNode } from "react";
|
|
@@ -14,7 +15,7 @@ const stylesMap = {
|
|
|
14
15
|
iconColor: "text-gray-600 dark:text-zinc-300",
|
|
15
16
|
titleColor: "text-gray-600 dark:text-zinc-300",
|
|
16
17
|
textColor: "text-gray-600 dark:text-zinc-300",
|
|
17
|
-
Icon: InfoIcon,
|
|
18
|
+
Icon: InfoIcon as LucideIcon,
|
|
18
19
|
},
|
|
19
20
|
tip: {
|
|
20
21
|
border: "border-green-500 dark:border-green-800",
|
|
@@ -22,7 +23,7 @@ const stylesMap = {
|
|
|
22
23
|
iconColor: "text-green-600 dark:text-green-200",
|
|
23
24
|
titleColor: "text-green-700 dark:text-green-200",
|
|
24
25
|
textColor: "text-green-600 dark:text-green-50",
|
|
25
|
-
Icon: LightbulbIcon,
|
|
26
|
+
Icon: LightbulbIcon as LucideIcon,
|
|
26
27
|
},
|
|
27
28
|
info: {
|
|
28
29
|
border: "border-blue-400 dark:border-blue-900/60",
|
|
@@ -30,7 +31,7 @@ const stylesMap = {
|
|
|
30
31
|
iconColor: "text-blue-400 dark:text-blue-200",
|
|
31
32
|
titleColor: "text-blue-700 dark:text-blue-200",
|
|
32
33
|
textColor: "text-blue-600 dark:text-blue-100",
|
|
33
|
-
Icon: InfoIcon,
|
|
34
|
+
Icon: InfoIcon as LucideIcon,
|
|
34
35
|
},
|
|
35
36
|
caution: {
|
|
36
37
|
border: "border-yellow-400 dark:border-yellow-400/25",
|
|
@@ -38,7 +39,7 @@ const stylesMap = {
|
|
|
38
39
|
iconColor: "text-yellow-500 dark:text-yellow-300",
|
|
39
40
|
titleColor: "text-yellow-600 dark:text-yellow-300",
|
|
40
41
|
textColor: "text-yellow-700 dark:text-yellow-200",
|
|
41
|
-
Icon: AlertTriangleIcon,
|
|
42
|
+
Icon: AlertTriangleIcon as LucideIcon,
|
|
42
43
|
},
|
|
43
44
|
danger: {
|
|
44
45
|
border: "border-rose-400 dark:border-rose-800",
|
|
@@ -46,9 +47,9 @@ const stylesMap = {
|
|
|
46
47
|
iconColor: "text-rose-400 dark:text-rose-300",
|
|
47
48
|
titleColor: "text-rose-800 dark:text-rose-300",
|
|
48
49
|
textColor: "text-rose-700 dark:text-rose-100",
|
|
49
|
-
Icon: ShieldAlertIcon,
|
|
50
|
+
Icon: ShieldAlertIcon as LucideIcon,
|
|
50
51
|
},
|
|
51
|
-
};
|
|
52
|
+
} as const;
|
|
52
53
|
|
|
53
54
|
type CalloutProps = {
|
|
54
55
|
type: keyof typeof stylesMap;
|
package/src/lib/ui/Drawer.tsx
CHANGED
|
@@ -13,16 +13,16 @@ const Drawer = ({
|
|
|
13
13
|
);
|
|
14
14
|
Drawer.displayName = "Drawer";
|
|
15
15
|
|
|
16
|
-
const DrawerTrigger = DrawerPrimitive.Trigger;
|
|
16
|
+
const DrawerTrigger: typeof DrawerPrimitive.Trigger = DrawerPrimitive.Trigger;
|
|
17
17
|
|
|
18
|
-
const DrawerPortal = DrawerPrimitive.Portal;
|
|
18
|
+
const DrawerPortal: typeof DrawerPrimitive.Portal = DrawerPrimitive.Portal;
|
|
19
19
|
|
|
20
|
-
const DrawerClose = DrawerPrimitive.Close;
|
|
20
|
+
const DrawerClose: typeof DrawerPrimitive.Close = DrawerPrimitive.Close;
|
|
21
21
|
|
|
22
|
-
const DrawerOverlay
|
|
23
|
-
React.
|
|
24
|
-
|
|
25
|
-
>(({ className, ...props }, ref) => (
|
|
22
|
+
const DrawerOverlay: React.ForwardRefExoticComponent<
|
|
23
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay> &
|
|
24
|
+
React.RefAttributes<React.ElementRef<typeof DrawerPrimitive.Overlay>>
|
|
25
|
+
> = React.forwardRef(({ className, ...props }, ref) => (
|
|
26
26
|
<DrawerPrimitive.Overlay
|
|
27
27
|
ref={ref}
|
|
28
28
|
className={cn("fixed inset-0 z-50 bg-black/80", className)}
|
|
@@ -31,29 +31,31 @@ const DrawerOverlay = React.forwardRef<
|
|
|
31
31
|
));
|
|
32
32
|
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
|
|
33
33
|
|
|
34
|
-
const DrawerContent
|
|
35
|
-
React.ElementRef<typeof DrawerPrimitive.Content>,
|
|
34
|
+
const DrawerContent: React.ForwardRefExoticComponent<
|
|
36
35
|
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> & {
|
|
37
36
|
hideBar?: boolean;
|
|
38
|
-
}
|
|
39
|
-
>
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
37
|
+
} & React.RefAttributes<React.ElementRef<typeof DrawerPrimitive.Content>>
|
|
38
|
+
> = React.forwardRef(
|
|
39
|
+
({ className, children, hideBar = true, ...props }, ref) => (
|
|
40
|
+
<DrawerPortal>
|
|
41
|
+
<DrawerOverlay />
|
|
42
|
+
<DrawerPrimitive.Content
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(
|
|
45
|
+
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
|
|
46
|
+
className,
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
>
|
|
50
|
+
{!hideBar && (
|
|
51
|
+
<div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
|
|
52
|
+
)}
|
|
53
|
+
{children}
|
|
54
|
+
</DrawerPrimitive.Content>
|
|
55
|
+
</DrawerPortal>
|
|
56
|
+
),
|
|
57
|
+
);
|
|
58
|
+
|
|
57
59
|
DrawerContent.displayName = "DrawerContent";
|
|
58
60
|
|
|
59
61
|
const DrawerHeader = ({
|
|
@@ -78,10 +80,10 @@ const DrawerFooter = ({
|
|
|
78
80
|
);
|
|
79
81
|
DrawerFooter.displayName = "DrawerFooter";
|
|
80
82
|
|
|
81
|
-
const DrawerTitle
|
|
82
|
-
React.
|
|
83
|
-
|
|
84
|
-
>(({ className, ...props }, ref) => (
|
|
83
|
+
const DrawerTitle: React.ForwardRefExoticComponent<
|
|
84
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title> &
|
|
85
|
+
React.RefAttributes<React.ElementRef<typeof DrawerPrimitive.Title>>
|
|
86
|
+
> = React.forwardRef(({ className, ...props }, ref) => (
|
|
85
87
|
<DrawerPrimitive.Title
|
|
86
88
|
ref={ref}
|
|
87
89
|
className={cn(
|
|
@@ -93,10 +95,10 @@ const DrawerTitle = React.forwardRef<
|
|
|
93
95
|
));
|
|
94
96
|
DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
|
|
95
97
|
|
|
96
|
-
const DrawerDescription
|
|
97
|
-
React.
|
|
98
|
-
|
|
99
|
-
>(({ className, ...props }, ref) => (
|
|
98
|
+
const DrawerDescription: React.ForwardRefExoticComponent<
|
|
99
|
+
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description> &
|
|
100
|
+
React.RefAttributes<React.ElementRef<typeof DrawerPrimitive.Description>>
|
|
101
|
+
> = React.forwardRef(({ className, ...props }, ref) => (
|
|
100
102
|
<DrawerPrimitive.Description
|
|
101
103
|
ref={ref}
|
|
102
104
|
className={cn("text-sm text-muted-foreground", className)}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useLocation, useNavigate, useSearchParams } from "react-router-dom";
|
|
2
|
+
import type { ExposedComponentProps } from "../components/SlotletProvider.js";
|
|
3
|
+
|
|
4
|
+
export const useExposedProps = (): ExposedComponentProps => {
|
|
5
|
+
const location = useLocation();
|
|
6
|
+
const navigate = useNavigate();
|
|
7
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
8
|
+
|
|
9
|
+
return { location, navigate, searchParams, setSearchParams };
|
|
10
|
+
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type { DevPortalPlugin, NavigationPlugin } from "../../core/plugins.js";
|
|
3
|
-
type CustomPageConfig = Array<{
|
|
4
|
-
path: string;
|
|
5
|
-
element: ReactNode;
|
|
6
|
-
}>;
|
|
7
|
-
export declare const customPagePlugin: (config: CustomPageConfig) => DevPortalPlugin & NavigationPlugin;
|
|
8
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ProseClasses } from "../../components/Markdown.js";
|
|
3
|
-
export const customPagePlugin = (config) => {
|
|
4
|
-
return {
|
|
5
|
-
getRoutes: () => config.map(({ path, element }) => ({
|
|
6
|
-
path,
|
|
7
|
-
// TODO: we should componentize prose pages
|
|
8
|
-
element: _jsx("div", { className: ProseClasses + " max-w-full", children: element }),
|
|
9
|
-
})),
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=index.js.map
|