zudoku 0.65.3 → 0.66.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.
- package/dist/app/sentry.js +1 -1
- package/dist/config/validators/BuildSchema.js +18 -3
- package/dist/config/validators/BuildSchema.js.map +1 -1
- package/dist/config/validators/validate.d.ts +45 -3
- package/dist/config/validators/validate.js +7 -1
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +9 -2
- package/dist/lib/components/Mermaid.d.ts +7 -0
- package/dist/lib/components/Mermaid.js +42 -0
- package/dist/lib/components/Mermaid.js.map +1 -0
- package/dist/lib/components/PagefindSearchMeta.d.ts +8 -0
- package/dist/lib/components/PagefindSearchMeta.js +7 -0
- package/dist/lib/components/PagefindSearchMeta.js.map +1 -0
- package/dist/lib/components/Zudoku.js +2 -5
- package/dist/lib/components/Zudoku.js.map +1 -1
- package/dist/lib/core/RouteGuard.js +1 -1
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +3 -3
- package/dist/lib/oas/parser/index.d.ts +1 -0
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/openapi/DownloadSchemaButton.d.ts +3 -0
- package/dist/lib/plugins/openapi/DownloadSchemaButton.js +47 -0
- package/dist/lib/plugins/openapi/DownloadSchemaButton.js.map +1 -0
- package/dist/lib/plugins/openapi/Endpoint.js +3 -6
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/OasProvider.js +22 -13
- package/dist/lib/plugins/openapi/OasProvider.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +12 -6
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +2 -2
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaList.js +2 -1
- package/dist/lib/plugins/openapi/SchemaList.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +11 -5
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +16 -13
- package/dist/lib/plugins/openapi/playground/Playground.js +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.d.ts +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +14 -6
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/utils.d.ts +2 -2
- package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
- package/dist/lib/plugins/openapi/util/getRoutes.d.ts +6 -1
- package/dist/lib/plugins/openapi/util/getRoutes.js +29 -2
- package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
- package/dist/lib/plugins/search-pagefind/IndexingDialog.d.ts +3 -0
- package/dist/lib/plugins/search-pagefind/IndexingDialog.js +64 -0
- package/dist/lib/plugins/search-pagefind/IndexingDialog.js.map +1 -0
- package/dist/lib/plugins/search-pagefind/PagefindSearch.js +22 -5
- package/dist/lib/plugins/search-pagefind/PagefindSearch.js.map +1 -1
- package/dist/lib/plugins/search-pagefind/ResultList.js +5 -4
- package/dist/lib/plugins/search-pagefind/ResultList.js.map +1 -1
- package/dist/lib/shiki.d.ts +1 -1
- package/dist/lib/shiki.js +18 -12
- package/dist/lib/shiki.js.map +1 -1
- package/dist/lib/ui/Button.d.ts +2 -2
- package/dist/lib/ui/Button.js +9 -8
- package/dist/lib/ui/Button.js.map +1 -1
- package/dist/lib/ui/ButtonGroup.d.ts +11 -0
- package/dist/lib/ui/ButtonGroup.js +28 -0
- package/dist/lib/ui/ButtonGroup.js.map +1 -0
- package/dist/lib/ui/Command.js +2 -2
- package/dist/lib/ui/Command.js.map +1 -1
- package/dist/lib/ui/DropdownMenu.d.ts +21 -23
- package/dist/lib/ui/DropdownMenu.js +47 -32
- package/dist/lib/ui/DropdownMenu.js.map +1 -1
- package/dist/lib/ui/Kbd.d.ts +3 -0
- package/dist/lib/ui/Kbd.js +10 -0
- package/dist/lib/ui/Kbd.js.map +1 -0
- package/dist/lib/util/MdxComponents.d.ts +1 -0
- package/dist/lib/util/MdxComponents.js +2 -0
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/flattenAllOf.js +27 -4
- package/dist/lib/util/flattenAllOf.js.map +1 -1
- package/dist/lib/util/flattenAllOf.test.js +67 -12
- package/dist/lib/util/flattenAllOf.test.js.map +1 -1
- package/dist/vite/api/SchemaManager.d.ts +5 -0
- package/dist/vite/api/SchemaManager.js +24 -0
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/api/SchemaManager.test.js +67 -0
- package/dist/vite/api/SchemaManager.test.js.map +1 -1
- package/dist/vite/config.js +8 -2
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.js +25 -0
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/pagefind-dev-index.d.ts +16 -0
- package/dist/vite/pagefind-dev-index.js +68 -0
- package/dist/vite/pagefind-dev-index.js.map +1 -0
- package/dist/vite/plugin-api.js +41 -3
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/prerender/prerender.js +1 -19
- package/dist/vite/prerender/prerender.js.map +1 -1
- package/dist/vite/prerender/utils.d.ts +2 -0
- package/dist/vite/prerender/utils.js +24 -0
- package/dist/vite/prerender/utils.js.map +1 -0
- package/lib/Button-CynVW1JV.js +53 -0
- package/lib/Button-CynVW1JV.js.map +1 -0
- package/lib/ClaudeLogo-PxFjou9w.js +69 -0
- package/lib/ClaudeLogo-PxFjou9w.js.map +1 -0
- package/lib/{Command-CUcrW3qs.js → Command-BpT1iBE6.js} +25 -25
- package/lib/Command-BpT1iBE6.js.map +1 -0
- package/lib/Drawer-Ci7XwhqT.js.map +1 -1
- package/lib/DropdownMenu-C8SX_-S_.js +104 -0
- package/lib/DropdownMenu-C8SX_-S_.js.map +1 -0
- package/lib/{ErrorAlert-D5LKLFOd.js → ErrorAlert-BqjbNHIn.js} +1017 -1015
- package/lib/{ErrorAlert-D5LKLFOd.js.map → ErrorAlert-BqjbNHIn.js.map} +1 -1
- package/lib/IndexingDialog-B5zCiUKr.js +100 -0
- package/lib/IndexingDialog-B5zCiUKr.js.map +1 -0
- package/lib/MdxPage-CVFatbHw.js +210 -0
- package/lib/MdxPage-CVFatbHw.js.map +1 -0
- package/lib/Mermaid-CIFixY6C.js +102 -0
- package/lib/Mermaid-CIFixY6C.js.map +1 -0
- package/lib/{OAuthErrorPage-oXnxcJg4.js → OAuthErrorPage-Dup79DJk.js} +7 -7
- package/lib/{OAuthErrorPage-oXnxcJg4.js.map → OAuthErrorPage-Dup79DJk.js.map} +1 -1
- package/lib/OasProvider-BJeMq29o.js +40 -0
- package/lib/OasProvider-BJeMq29o.js.map +1 -0
- package/lib/{OperationList-CmMoKpGu.js → OperationList-ff3ZvQsO.js} +1701 -1585
- package/lib/OperationList-ff3ZvQsO.js.map +1 -0
- package/lib/{RouteGuard-Brz95MSt.js → RouteGuard-BXy13JSz.js} +19 -19
- package/lib/{RouteGuard-Brz95MSt.js.map → RouteGuard-BXy13JSz.js.map} +1 -1
- package/lib/{RouterError-VGZB_wg4.js → RouterError-CKOZTsDD.js} +3 -3
- package/lib/{RouterError-VGZB_wg4.js.map → RouterError-CKOZTsDD.js.map} +1 -1
- package/lib/{SchemaList-BykD27ga.js → SchemaList-BSC1KM3v.js} +28 -27
- package/lib/SchemaList-BSC1KM3v.js.map +1 -0
- package/lib/{SchemaView-Dt6hbCAt.js → SchemaView-CgwJ9gtb.js} +198 -187
- package/lib/SchemaView-CgwJ9gtb.js.map +1 -0
- package/lib/Select-VmDZ-nKe.js +337 -0
- package/lib/Select-VmDZ-nKe.js.map +1 -0
- package/lib/{SignUp-D2mmQOkg.js → SignUp-Pm_LGm6T.js} +13 -13
- package/lib/{SignUp-D2mmQOkg.js.map → SignUp-Pm_LGm6T.js.map} +1 -1
- package/lib/{SyntaxHighlight-C19vH0V_.js → SyntaxHighlight-bkmst3oV.js} +654 -622
- package/lib/SyntaxHighlight-bkmst3oV.js.map +1 -0
- package/lib/{Toc-CBWfFCVf.js → Toc-TUXNFbKl.js} +2 -2
- package/lib/{Toc-CBWfFCVf.js.map → Toc-TUXNFbKl.js.map} +1 -1
- package/lib/{ZudokuContext-BUZ5hkWB.js → ZudokuContext-np1wheDl.js} +8 -8
- package/lib/{ZudokuContext-BUZ5hkWB.js.map → ZudokuContext-np1wheDl.js.map} +1 -1
- package/lib/___vite-browser-external_commonjs-proxy-Cga3HsWk.js +9 -0
- package/lib/___vite-browser-external_commonjs-proxy-Cga3HsWk.js.map +1 -0
- package/lib/{chunk-PVWAREVJ-BMhpCH5D.js → chunk-PVWAREVJ-dLIqswPy.js} +5 -5
- package/lib/{chunk-PVWAREVJ-BMhpCH5D.js.map → chunk-PVWAREVJ-dLIqswPy.js.map} +1 -1
- package/lib/{circular-CNHs4gAz.js → circular-XPj_dwqA.js} +2 -2
- package/lib/{circular-CNHs4gAz.js.map → circular-XPj_dwqA.js.map} +1 -1
- package/lib/createServer-D01nCTNp.js +16693 -0
- package/lib/createServer-D01nCTNp.js.map +1 -0
- package/lib/{errors-D7xzOd8X.js → errors-B0hNTPFO.js} +3 -3
- package/lib/{errors-D7xzOd8X.js.map → errors-B0hNTPFO.js.map} +1 -1
- package/lib/{hook-CMeoxziF.js → hook-CvSwcbk6.js} +3 -3
- package/lib/{hook-CMeoxziF.js.map → hook-CvSwcbk6.js.map} +1 -1
- package/lib/{index-unv8c40u.js → index-Bjc_QsUR.js} +754 -738
- package/lib/{index-unv8c40u.js.map → index-Bjc_QsUR.js.map} +1 -1
- package/lib/index-CrcNWbel.js.map +1 -1
- package/lib/index-DnMgJWrI.js +133 -0
- package/lib/index-DnMgJWrI.js.map +1 -0
- package/lib/{index-CF7_erXq.js → index-DscsS121.js} +2 -2
- package/lib/{index-CF7_erXq.js.map → index-DscsS121.js.map} +1 -1
- package/lib/{index-CPws05Tb.js → index-mfkNWYG-.js} +10 -10
- package/lib/{index-CPws05Tb.js.map → index-mfkNWYG-.js.map} +1 -1
- package/lib/{index.esm-BnYHxCYC.js → index.esm-DtzT_KoE.js} +20 -20
- package/lib/{index.esm-BnYHxCYC.js.map → index.esm-DtzT_KoE.js.map} +1 -1
- package/lib/{invariant-Bm-FVUQE.js → invariant-CGOLuIIz.js} +3 -3
- package/lib/{invariant-Bm-FVUQE.js.map → invariant-CGOLuIIz.js.map} +1 -1
- package/lib/{mutation-BSU0xu4m.js → mutation-BlmnL5qL.js} +2 -2
- package/lib/{mutation-BSU0xu4m.js.map → mutation-BlmnL5qL.js.map} +1 -1
- package/lib/ui/ActionButton.js +1 -1
- package/lib/ui/Button.js +25 -24
- package/lib/ui/Button.js.map +1 -1
- package/lib/ui/ButtonGroup.js +77 -0
- package/lib/ui/ButtonGroup.js.map +1 -0
- package/lib/ui/Command.js +3 -3
- package/lib/ui/Command.js.map +1 -1
- package/lib/ui/DropdownMenu.js +227 -140
- package/lib/ui/DropdownMenu.js.map +1 -1
- package/lib/ui/Kbd.js +32 -0
- package/lib/ui/Kbd.js.map +1 -0
- package/lib/ui/SyntaxHighlight.js +3 -3
- package/lib/zudoku.__internal.js +8 -8
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-azureb2c.js +4 -4
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +5 -5
- package/lib/zudoku.auth-supabase.js +5 -5
- package/lib/zudoku.components.js +7 -7
- package/lib/zudoku.hooks.js +11 -24
- package/lib/zudoku.hooks.js.map +1 -1
- package/lib/zudoku.mermaid.js +10 -0
- package/lib/zudoku.mermaid.js.map +1 -0
- package/lib/zudoku.plugin-api-catalog.js +6 -6
- package/lib/zudoku.plugin-api-keys.js +223 -198
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +3 -3
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +184 -226
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/lib/zudoku.plugins.js.map +1 -1
- package/lib/zudoku.router.js +2 -2
- package/package.json +29 -21
- package/src/app/sentry.ts +1 -1
- package/src/lib/components/Mermaid.tsx +68 -0
- package/src/lib/components/PagefindSearchMeta.tsx +14 -0
- package/src/lib/components/Zudoku.tsx +4 -7
- package/src/lib/core/RouteGuard.tsx +1 -1
- package/src/lib/core/plugins.ts +2 -2
- package/src/lib/oas/parser/index.ts +2 -0
- package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +115 -0
- package/src/lib/plugins/openapi/Endpoint.tsx +20 -27
- package/src/lib/plugins/openapi/OasProvider.tsx +30 -17
- package/src/lib/plugins/openapi/OperationList.tsx +39 -21
- package/src/lib/plugins/openapi/OperationListItem.tsx +5 -5
- package/src/lib/plugins/openapi/SchemaList.tsx +4 -0
- package/src/lib/plugins/openapi/index.tsx +16 -7
- package/src/lib/plugins/openapi/interfaces.ts +16 -7
- package/src/lib/plugins/openapi/playground/Playground.tsx +1 -1
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +36 -27
- package/src/lib/plugins/openapi/schema/utils.ts +5 -2
- package/src/lib/plugins/openapi/util/getRoutes.tsx +35 -3
- package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +163 -0
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +61 -22
- package/src/lib/plugins/search-pagefind/ResultList.tsx +8 -3
- package/src/lib/shiki.ts +21 -12
- package/src/lib/ui/Button.tsx +10 -10
- package/src/lib/ui/ButtonGroup.tsx +82 -0
- package/src/lib/ui/Command.tsx +3 -3
- package/src/lib/ui/DropdownMenu.tsx +226 -170
- package/src/lib/ui/Kbd.tsx +28 -0
- package/src/lib/util/MdxComponents.tsx +2 -0
- package/src/lib/util/flattenAllOf.test.ts +71 -19
- package/src/lib/util/flattenAllOf.ts +29 -8
- package/src/shiki/langs/markdown-nix.js +1 -0
- package/src/shiki/langs/openscad.js +1 -0
- package/dist/vite/create-pagefind-index.d.ts +0 -4
- package/dist/vite/create-pagefind-index.js +0 -12
- package/dist/vite/create-pagefind-index.js.map +0 -1
- package/lib/Button-B3ucvvQw.js +0 -52
- package/lib/Button-B3ucvvQw.js.map +0 -1
- package/lib/Command-CUcrW3qs.js.map +0 -1
- package/lib/DropdownMenu-BZ2NKQ3K.js +0 -126
- package/lib/DropdownMenu-BZ2NKQ3K.js.map +0 -1
- package/lib/MdxPage-hOCN-u-L.js +0 -240
- package/lib/MdxPage-hOCN-u-L.js.map +0 -1
- package/lib/OasProvider-CpniNNrW.js +0 -36
- package/lib/OasProvider-CpniNNrW.js.map +0 -1
- package/lib/OperationList-CmMoKpGu.js.map +0 -1
- package/lib/Pagination-lLSoHnxa.js +0 -37
- package/lib/Pagination-lLSoHnxa.js.map +0 -1
- package/lib/SchemaList-BykD27ga.js.map +0 -1
- package/lib/SchemaView-Dt6hbCAt.js.map +0 -1
- package/lib/Select-DFRCS31-.js +0 -399
- package/lib/Select-DFRCS31-.js.map +0 -1
- package/lib/SyntaxHighlight-C19vH0V_.js.map +0 -1
- package/lib/createServer-BmcVQAOQ.js +0 -13018
- package/lib/createServer-BmcVQAOQ.js.map +0 -1
- package/lib/useExposedProps-U3pmsHaG.js +0 -113
- package/lib/useExposedProps-U3pmsHaG.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zudoku.plugins.js","sources":["../src/lib/core/plugins.ts"],"sourcesContent":["import type { LucideIcon } from \"lucide-react\";\nimport type {
|
|
1
|
+
{"version":3,"file":"zudoku.plugins.js","sources":["../src/lib/core/plugins.ts"],"sourcesContent":["import type { LucideIcon } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport type { Location, RouteObject } from \"react-router\";\nimport type { Navigation } from \"../../config/validators/NavigationSchema.js\";\nimport type { ProtectedRoutesInput } from \"../../config/validators/ProtectedRoutesSchema.js\";\nimport type { AuthenticationPlugin } from \"../authentication/authentication.js\";\nimport type { MdxComponentsType } from \"../util/MdxComponents.js\";\nimport type {\n ApiIdentity,\n ZudokuContext,\n ZudokuEvents,\n} from \"./ZudokuContext.js\";\n\nexport type ZudokuPlugin =\n | CommonPlugin\n | ProfileMenuPlugin\n | NavigationPlugin\n | ApiIdentityPlugin\n | SearchProviderPlugin\n | EventConsumerPlugin\n | AuthenticationPlugin;\n\nexport type { AuthenticationPlugin, RouteObject };\n\nexport interface NavigationPlugin {\n getRoutes: () => RouteObject[];\n getNavigation?: (path: string, context: ZudokuContext) => Promise<Navigation>;\n getProtectedRoutes?: () => ProtectedRoutesInput;\n}\n\nexport const createApiIdentityPlugin = (\n plugin: ApiIdentityPlugin,\n): ApiIdentityPlugin => plugin;\n\nexport const createProfileMenuPlugin = (\n plugin: ProfileMenuPlugin,\n): ProfileMenuPlugin => plugin;\n\nexport interface ApiIdentityPlugin {\n getIdentities: (context: ZudokuContext) => Promise<ApiIdentity[]>;\n}\n\nexport interface SearchProviderPlugin {\n renderSearch: (o: {\n isOpen: boolean;\n onClose: () => void;\n }) => React.JSX.Element | null;\n}\n\nexport interface ProfileMenuPlugin {\n getProfileMenuItems: (context: ZudokuContext) => ProfileNavigationItem[];\n}\n\nexport type ProfileNavigationItem = {\n label: string;\n path?: string;\n weight?: number;\n category?: \"top\" | \"middle\" | \"bottom\";\n children?: ProfileNavigationItem[];\n icon?: LucideIcon;\n};\n\nexport interface CommonPlugin {\n initialize?: (\n context: ZudokuContext,\n ) => Promise<void | boolean> | void | boolean;\n getHead?: (args: { location: Location }) => ReactNode | undefined;\n getMdxComponents?: () => MdxComponentsType;\n}\n\nexport type EventConsumerPlugin<Event extends ZudokuEvents = ZudokuEvents> = {\n events: { [K in keyof Event]?: Event[K] };\n};\n\nexport const isEventConsumerPlugin = (\n obj: ZudokuPlugin,\n): obj is EventConsumerPlugin =>\n \"events\" in obj && typeof obj.events === \"object\";\n\nexport const isProfileMenuPlugin = (\n obj: ZudokuPlugin,\n): obj is ProfileMenuPlugin =>\n \"getProfileMenuItems\" in obj && typeof obj.getProfileMenuItems === \"function\";\n\nexport const isNavigationPlugin = (\n obj: ZudokuPlugin,\n): obj is NavigationPlugin =>\n \"getRoutes\" in obj && typeof obj.getRoutes === \"function\";\n\nexport const isAuthenticationPlugin = (\n obj: ZudokuPlugin,\n): obj is AuthenticationPlugin =>\n \"signUp\" in obj && typeof obj.signUp === \"function\";\n\nexport const isSearchPlugin = (\n obj: ZudokuPlugin,\n): obj is SearchProviderPlugin =>\n \"renderSearch\" in obj && typeof obj.renderSearch === \"function\";\n\nexport const needsInitialization = (obj: ZudokuPlugin): obj is CommonPlugin =>\n \"initialize\" in obj && typeof obj.initialize === \"function\";\n\nexport const hasHead = (obj: ZudokuPlugin): obj is CommonPlugin =>\n \"getHead\" in obj && typeof obj.getHead === \"function\";\n\nexport const isMdxProviderPlugin = (obj: ZudokuPlugin): obj is CommonPlugin =>\n \"getMdxComponents\" in obj && typeof obj.getMdxComponents === \"function\";\n\nexport const isApiIdentityPlugin = (\n obj: ZudokuPlugin,\n): obj is ApiIdentityPlugin =>\n \"getIdentities\" in obj && typeof obj.getIdentities === \"function\";\n"],"names":["createApiIdentityPlugin","plugin","createProfileMenuPlugin","isEventConsumerPlugin","obj","isProfileMenuPlugin","isNavigationPlugin","isAuthenticationPlugin","isSearchPlugin","needsInitialization","hasHead","isMdxProviderPlugin","isApiIdentityPlugin"],"mappings":"AA8BO,MAAMA,IAA0B,CACrCC,MACsBA,GAEXC,IAA0B,CACrCD,MACsBA,GAsCXE,IAAwB,CACnCC,MAEA,YAAYA,KAAO,OAAOA,EAAI,UAAW,UAE9BC,IAAsB,CACjCD,MAEA,yBAAyBA,KAAO,OAAOA,EAAI,uBAAwB,YAExDE,IAAqB,CAChCF,MAEA,eAAeA,KAAO,OAAOA,EAAI,aAAc,YAEpCG,IAAyB,CACpCH,MAEA,YAAYA,KAAO,OAAOA,EAAI,UAAW,YAE9BI,IAAiB,CAC5BJ,MAEA,kBAAkBA,KAAO,OAAOA,EAAI,gBAAiB,YAE1CK,IAAsB,CAACL,MAClC,gBAAgBA,KAAO,OAAOA,EAAI,cAAe,YAEtCM,IAAU,CAACN,MACtB,aAAaA,KAAO,OAAOA,EAAI,WAAY,YAEhCO,IAAsB,CAACP,MAClC,sBAAsBA,KAAO,OAAOA,EAAI,oBAAqB,YAElDQ,IAAsB,CACjCR,MAEA,mBAAmBA,KAAO,OAAOA,EAAI,iBAAkB;"}
|
package/lib/zudoku.router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as We, s as $, g as ve, F as j, R as qe, S as Se, h as Ge,
|
|
2
|
-
import { a2 as Ur, a3 as Mr, a4 as Nr, a5 as Or, a6 as zr, a7 as Br, a8 as $r, L as jr, a9 as Vr, aa as Wr, ab as qr, ac as Gr, N as Xr, ad as Yr, ae as Jr, af as Kr, ag as Qr, ah as Zr, ai as ea, aj as ta, ak as ra, al as aa, am as na, an as oa, ao as sa, ap as ia, aq as la, ar as ua, as as da, at as ca, au as fa, av as ha, aw as pa, ax as ma, ay as ya, az as Ra, aA as wa, aB as ga, aC as va, aD as Sa, aE as Ea, aF as _a, aG as ba, aH as Ca, aI as Da, aJ as Aa, aK as xa, aL as Fa, m as ka, aM as La, aN as Ta, aO as Ha, aP as Ia, aQ as Pa, aR as Ua, aS as Ma, aT as Na, aU as Oa, aV as za, aW as Ba, aX as $a, aY as ja, aZ as Va, a_ as Wa, a$ as qa, b0 as Ga,
|
|
1
|
+
import { f as We, s as $, g as ve, F as j, R as qe, S as Se, h as Ge, d as Xe, E as D, j as Ee, k as X, l as U, n as Ye, o as oe, p as Je, q as Ke, t as _e, v as Qe, w as be, x as Ce, i as A, y as De, z as Ze, A as C, B as et, C as tt, D as rt, G as at, O as nt, H as L, I as ot, J as st, K as it, M as lt, P as T, Q as ut, T as dt, r as ct, U as Z, V as ft, W as ht, X as pt, Y as mt, Z as yt, _ as Rt, $ as wt, a0 as gt, a1 as vt } from "./chunk-PVWAREVJ-dLIqswPy.js";
|
|
2
|
+
import { a2 as Ur, a3 as Mr, a4 as Nr, a5 as Or, a6 as zr, a7 as Br, a8 as $r, L as jr, a9 as Vr, aa as Wr, ab as qr, ac as Gr, N as Xr, ad as Yr, ae as Jr, af as Kr, ag as Qr, ah as Zr, ai as ea, aj as ta, ak as ra, al as aa, am as na, an as oa, ao as sa, ap as ia, aq as la, ar as ua, as as da, at as ca, au as fa, av as ha, aw as pa, ax as ma, ay as ya, az as Ra, aA as wa, aB as ga, aC as va, aD as Sa, aE as Ea, aF as _a, aG as ba, aH as Ca, aI as Da, aJ as Aa, aK as xa, aL as Fa, m as ka, aM as La, aN as Ta, aO as Ha, aP as Ia, aQ as Pa, aR as Ua, aS as Ma, aT as Na, aU as Oa, aV as za, aW as Ba, aX as $a, aY as ja, aZ as Va, a_ as Wa, a$ as qa, b0 as Ga, a as Xa, e as Ya, b1 as Ja, u as Ka, b2 as Qa, b3 as Za, b4 as en, b5 as tn, c as rn, b6 as an, b7 as nn, b8 as on, b9 as sn, b as ln, ba as un, bb as dn } from "./chunk-PVWAREVJ-dLIqswPy.js";
|
|
3
3
|
import * as g from "react";
|
|
4
4
|
import E from "react";
|
|
5
5
|
import * as St from "react-dom";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zudoku",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://zudoku.dev",
|
|
6
6
|
"repository": {
|
|
@@ -103,6 +103,10 @@
|
|
|
103
103
|
"import": "./lib/zudoku.components.js",
|
|
104
104
|
"types": "./dist/lib/components/index.d.ts"
|
|
105
105
|
},
|
|
106
|
+
"./mermaid": {
|
|
107
|
+
"import": "./lib/zudoku.mermaid.js",
|
|
108
|
+
"types": "./dist/lib/components/Mermaid.d.ts"
|
|
109
|
+
},
|
|
106
110
|
"./__internal": {
|
|
107
111
|
"import": "./lib/zudoku.__internal.js",
|
|
108
112
|
"types": "./dist/lib/__internal.d.ts"
|
|
@@ -171,19 +175,19 @@
|
|
|
171
175
|
"@radix-ui/react-tooltip": "1.2.8",
|
|
172
176
|
"@radix-ui/react-visually-hidden": "1.2.4",
|
|
173
177
|
"@scalar/openapi-parser": "0.23.2",
|
|
174
|
-
"@sentry/node": "
|
|
175
|
-
"@shikijs/engine-javascript": "3.
|
|
176
|
-
"@shikijs/langs": "3.
|
|
177
|
-
"@shikijs/rehype": "3.
|
|
178
|
-
"@shikijs/themes": "3.
|
|
179
|
-
"@shikijs/transformers": "3.
|
|
178
|
+
"@sentry/node": "10.27.0",
|
|
179
|
+
"@shikijs/engine-javascript": "3.17.0",
|
|
180
|
+
"@shikijs/langs": "3.17.0",
|
|
181
|
+
"@shikijs/rehype": "3.17.0",
|
|
182
|
+
"@shikijs/themes": "3.17.0",
|
|
183
|
+
"@shikijs/transformers": "3.17.0",
|
|
180
184
|
"@sindresorhus/slugify": "3.0.0",
|
|
181
185
|
"@stefanprobst/rehype-extract-toc": "3.0.0",
|
|
182
186
|
"@tailwindcss/typography": "0.5.19",
|
|
183
187
|
"@tailwindcss/vite": "4.1.16",
|
|
184
188
|
"@tanem/react-nprogress": "5.0.56",
|
|
185
189
|
"@tanstack/react-query": "5.85.5",
|
|
186
|
-
"@types/react": "19.2.
|
|
190
|
+
"@types/react": "19.2.7",
|
|
187
191
|
"@types/react-dom": "19.2.0",
|
|
188
192
|
"@vitejs/plugin-react": "5.1.0",
|
|
189
193
|
"@x0k/json-schema-merge": "1.0.2",
|
|
@@ -195,9 +199,9 @@
|
|
|
195
199
|
"cmdk": "1.1.1",
|
|
196
200
|
"embla-carousel-react": "8.6.0",
|
|
197
201
|
"estree-util-value-to-estree": "3.4.1",
|
|
198
|
-
"express": "5.
|
|
202
|
+
"express": "5.2.0",
|
|
199
203
|
"fast-equals": "5.2.2",
|
|
200
|
-
"glob": "
|
|
204
|
+
"glob": "13.0.0",
|
|
201
205
|
"glob-parent": "6.0.2",
|
|
202
206
|
"graphql": "16.12.0",
|
|
203
207
|
"graphql-type-json": "0.3.2",
|
|
@@ -210,15 +214,15 @@
|
|
|
210
214
|
"json-schema-to-typescript-lite": "15.0.0",
|
|
211
215
|
"loglevel": "1.9.2",
|
|
212
216
|
"lucide-react": "0.548.0",
|
|
213
|
-
"motion": "12.23.
|
|
217
|
+
"motion": "12.23.24",
|
|
214
218
|
"nanoevents": "^9.1.0",
|
|
215
219
|
"next-themes": "0.4.6",
|
|
216
220
|
"oauth4webapi": "2.17.0",
|
|
217
221
|
"openapi-types": "12.1.3",
|
|
218
|
-
"pagefind": "1.4.0
|
|
222
|
+
"pagefind": "1.4.0",
|
|
219
223
|
"picocolors": "1.1.1",
|
|
220
|
-
"piscina": "5.1.
|
|
221
|
-
"posthog-node": "5.
|
|
224
|
+
"piscina": "5.1.4",
|
|
225
|
+
"posthog-node": "5.14.1",
|
|
222
226
|
"react-error-boundary": "6.0.0",
|
|
223
227
|
"react-hook-form": "7.66.0",
|
|
224
228
|
"react-is": "19.2.0",
|
|
@@ -235,7 +239,7 @@
|
|
|
235
239
|
"remark-mdx-frontmatter": "5.2.0",
|
|
236
240
|
"rollup": "4.52.5",
|
|
237
241
|
"semver": "7.7.2",
|
|
238
|
-
"shiki": "3.
|
|
242
|
+
"shiki": "3.17.0",
|
|
239
243
|
"sitemap": "9.0.0",
|
|
240
244
|
"strip-ansi": "7.1.2",
|
|
241
245
|
"tailwind-merge": "3.3.1",
|
|
@@ -252,13 +256,13 @@
|
|
|
252
256
|
"zustand": "5.0.8"
|
|
253
257
|
},
|
|
254
258
|
"devDependencies": {
|
|
255
|
-
"@graphql-codegen/cli": "6.0
|
|
259
|
+
"@graphql-codegen/cli": "6.1.0",
|
|
256
260
|
"@inkeep/cxkit-types": "0.5.101",
|
|
257
261
|
"@testing-library/dom": "10.4.1",
|
|
258
262
|
"@testing-library/jest-dom": "6.9.1",
|
|
259
263
|
"@testing-library/react": "16.3.0",
|
|
260
264
|
"@types/estree": "1.0.8",
|
|
261
|
-
"@types/express": "5.0.
|
|
265
|
+
"@types/express": "5.0.5",
|
|
262
266
|
"@types/glob-parent": "5.1.3",
|
|
263
267
|
"@types/har-format": "1.2.16",
|
|
264
268
|
"@types/hast": "^3.0.4",
|
|
@@ -271,24 +275,25 @@
|
|
|
271
275
|
"@types/unist": "^3.0.3",
|
|
272
276
|
"@types/yargs": "17.0.35",
|
|
273
277
|
"@vitest/coverage-v8": "3.2.4",
|
|
274
|
-
"esbuild": "0.
|
|
278
|
+
"esbuild": "0.27.0",
|
|
275
279
|
"happy-dom": "20.0.10",
|
|
276
280
|
"mdast-util-mdx": "3.0.0",
|
|
277
281
|
"react": "19.2.0",
|
|
278
282
|
"react-dom": "19.2.0",
|
|
279
|
-
"rollup-plugin-visualizer": "6.0.
|
|
280
|
-
"tsx": "4.20.
|
|
283
|
+
"rollup-plugin-visualizer": "6.0.5",
|
|
284
|
+
"tsx": "4.20.6",
|
|
281
285
|
"typescript": "5.9.3",
|
|
282
286
|
"vitest": "4.0.6"
|
|
283
287
|
},
|
|
284
288
|
"peerDependencies": {
|
|
285
289
|
"@azure/msal-browser": "^4.13.0",
|
|
286
290
|
"@clerk/clerk-js": "^5.63.1",
|
|
287
|
-
"@sentry/react": "^
|
|
291
|
+
"@sentry/react": "^10.0.0",
|
|
288
292
|
"@supabase/auth-ui-react": "^0.4.0",
|
|
289
293
|
"@supabase/auth-ui-shared": "^0.1.0",
|
|
290
294
|
"@supabase/supabase-js": "^2.49.4",
|
|
291
295
|
"firebase": "^12.6.0",
|
|
296
|
+
"mermaid": "^11.0.0",
|
|
292
297
|
"react": ">=19.2.0",
|
|
293
298
|
"react-dom": ">=19.2.0"
|
|
294
299
|
},
|
|
@@ -313,6 +318,9 @@
|
|
|
313
318
|
},
|
|
314
319
|
"firebase": {
|
|
315
320
|
"optional": true
|
|
321
|
+
},
|
|
322
|
+
"mermaid": {
|
|
323
|
+
"optional": true
|
|
316
324
|
}
|
|
317
325
|
},
|
|
318
326
|
"scripts": {
|
package/src/app/sentry.ts
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import type { MermaidConfig } from "mermaid";
|
|
3
|
+
import type { ComponentProps } from "react";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { Alert, AlertDescription, AlertTitle } from "zudoku/ui/Alert.js";
|
|
6
|
+
import { useTheme } from "../hooks/index.js";
|
|
7
|
+
import { Spinner } from "./Spinner.js";
|
|
8
|
+
|
|
9
|
+
export type MermaidProps = {
|
|
10
|
+
chart: string;
|
|
11
|
+
config?: MermaidConfig;
|
|
12
|
+
} & ComponentProps<"div">;
|
|
13
|
+
|
|
14
|
+
let mermaidPromise: Promise<typeof import("mermaid").default> | null = null;
|
|
15
|
+
|
|
16
|
+
const loadMermaid = () => {
|
|
17
|
+
if (!mermaidPromise) {
|
|
18
|
+
mermaidPromise = import("mermaid")
|
|
19
|
+
.then((mod) => mod.default)
|
|
20
|
+
.catch((error) => {
|
|
21
|
+
throw new Error(
|
|
22
|
+
"Mermaid is not installed. Please install it with: npm install mermaid",
|
|
23
|
+
{ cause: error },
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return mermaidPromise;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Mermaid = ({ chart, config, ...props }: MermaidProps) => {
|
|
31
|
+
const id = useId();
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
data: svg,
|
|
36
|
+
error,
|
|
37
|
+
isPending,
|
|
38
|
+
} = useQuery({
|
|
39
|
+
queryKey: ["mermaid", chart, config, theme.resolvedTheme],
|
|
40
|
+
queryFn: async () => {
|
|
41
|
+
const mermaid = await loadMermaid();
|
|
42
|
+
mermaid.initialize({
|
|
43
|
+
theme: theme.resolvedTheme === "dark" ? "dark" : "base",
|
|
44
|
+
...config,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const { svg } = await mermaid.render(id, chart);
|
|
48
|
+
return svg;
|
|
49
|
+
},
|
|
50
|
+
enabled: typeof window !== "undefined",
|
|
51
|
+
retry: false,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (error)
|
|
55
|
+
return (
|
|
56
|
+
<Alert className="flex flex-col gap-2" variant="destructive">
|
|
57
|
+
<AlertTitle>Mermaid Error</AlertTitle>
|
|
58
|
+
<AlertDescription className="overflow-auto wrap-break-word whitespace-pre-wrap font-mono text-xs">
|
|
59
|
+
{error.message}
|
|
60
|
+
</AlertDescription>
|
|
61
|
+
</Alert>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
if (isPending) return <Spinner />;
|
|
65
|
+
|
|
66
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: Mermaid generates valid SVG
|
|
67
|
+
return <div {...props} dangerouslySetInnerHTML={{ __html: svg }} />;
|
|
68
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Adds metadata to be captured by Pagefind for search results.
|
|
5
|
+
* Content is visually hidden but indexed by the search engine.
|
|
6
|
+
*/
|
|
7
|
+
export const PagefindSearchMeta = ({
|
|
8
|
+
name,
|
|
9
|
+
children,
|
|
10
|
+
}: PropsWithChildren<{ name?: string }>) => (
|
|
11
|
+
<span data-pagefind-meta={name} className="sr-only">
|
|
12
|
+
{children}
|
|
13
|
+
</span>
|
|
14
|
+
);
|
|
@@ -74,16 +74,13 @@ const ZudokuInner = memo(
|
|
|
74
74
|
|
|
75
75
|
zudokuContext ??= new ZudokuContext(props, queryClient);
|
|
76
76
|
|
|
77
|
-
const heads = props.plugins
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
)
|
|
81
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: No other key is available
|
|
82
|
-
.map((entry, i) => <Helmet key={i}>{entry}</Helmet>);
|
|
77
|
+
const heads = props.plugins?.flatMap((plugin) =>
|
|
78
|
+
hasHead(plugin) ? (plugin.getHead?.({ location }) ?? []) : [],
|
|
79
|
+
);
|
|
83
80
|
|
|
84
81
|
return (
|
|
85
82
|
<>
|
|
86
|
-
{heads}
|
|
83
|
+
<Helmet>{heads}</Helmet>
|
|
87
84
|
<StaggeredRenderContext.Provider value={staggeredValue}>
|
|
88
85
|
<ZudokuProvider context={zudokuContext}>
|
|
89
86
|
<RouterEventsEmitter />
|
package/src/lib/core/plugins.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LucideIcon } from "lucide-react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
3
|
import type { Location, RouteObject } from "react-router";
|
|
4
4
|
import type { Navigation } from "../../config/validators/NavigationSchema.js";
|
|
5
5
|
import type { ProtectedRoutesInput } from "../../config/validators/ProtectedRoutesSchema.js";
|
|
@@ -64,7 +64,7 @@ export interface CommonPlugin {
|
|
|
64
64
|
initialize?: (
|
|
65
65
|
context: ZudokuContext,
|
|
66
66
|
) => Promise<void | boolean> | void | boolean;
|
|
67
|
-
getHead?: (
|
|
67
|
+
getHead?: (args: { location: Location }) => ReactNode | undefined;
|
|
68
68
|
getMdxComponents?: () => MdxComponentsType;
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -25,6 +25,8 @@ export type TagObject = DeepOmitReference<OpenAPIV3_1.TagObject>;
|
|
|
25
25
|
export type ExampleObject = DeepOmitReference<OpenAPIV3_1.ExampleObject>;
|
|
26
26
|
export type EncodingObject = DeepOmitReference<OpenAPIV3_1.EncodingObject>;
|
|
27
27
|
export type SchemaObject = DeepOmitReference<OpenAPIV3_1.SchemaObject>;
|
|
28
|
+
export type ArraySchemaObject =
|
|
29
|
+
DeepOmitReference<OpenAPIV3_1.ArraySchemaObject>;
|
|
28
30
|
export type ServerObject = DeepOmitReference<OpenAPIV3_1.ServerObject>;
|
|
29
31
|
|
|
30
32
|
export const HttpMethods = Object.values(OpenAPIV3.HttpMethods);
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChevronDownIcon,
|
|
3
|
+
CopyIcon,
|
|
4
|
+
DownloadIcon,
|
|
5
|
+
ExternalLinkIcon,
|
|
6
|
+
} from "lucide-react";
|
|
7
|
+
import type { MouseEventHandler } from "react";
|
|
8
|
+
import { Button } from "zudoku/components";
|
|
9
|
+
import { ButtonGroup } from "zudoku/ui/ButtonGroup.js";
|
|
10
|
+
import {
|
|
11
|
+
DropdownMenu,
|
|
12
|
+
DropdownMenuContent,
|
|
13
|
+
DropdownMenuItem,
|
|
14
|
+
DropdownMenuTrigger,
|
|
15
|
+
} from "zudoku/ui/DropdownMenu.js";
|
|
16
|
+
import { useCopyToClipboard } from "../../util/useCopyToClipboard.js";
|
|
17
|
+
import { ChatGPTLogo } from "../markdown/assets/ChatGPTLogo.js";
|
|
18
|
+
import { ClaudeLogo } from "../markdown/assets/ClaudeLogo.js";
|
|
19
|
+
|
|
20
|
+
export const DownloadSchemaButton = ({
|
|
21
|
+
downloadUrl,
|
|
22
|
+
}: {
|
|
23
|
+
downloadUrl: string;
|
|
24
|
+
}) => {
|
|
25
|
+
const [, copyToClipboard] = useCopyToClipboard();
|
|
26
|
+
|
|
27
|
+
const handleDownload: MouseEventHandler<HTMLAnchorElement> = async (e) => {
|
|
28
|
+
const isExternal = downloadUrl.includes("://");
|
|
29
|
+
|
|
30
|
+
if (!isExternal) return;
|
|
31
|
+
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(downloadUrl);
|
|
35
|
+
if (!response.ok)
|
|
36
|
+
throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
37
|
+
|
|
38
|
+
const blob = await response.blob();
|
|
39
|
+
const url = window.URL.createObjectURL(blob);
|
|
40
|
+
const a = document.createElement("a");
|
|
41
|
+
a.href = url;
|
|
42
|
+
a.download = downloadUrl.split("/").pop() || "schema.json";
|
|
43
|
+
document.body.appendChild(a);
|
|
44
|
+
a.click();
|
|
45
|
+
document.body.removeChild(a);
|
|
46
|
+
window.URL.revokeObjectURL(url);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
// biome-ignore lint/suspicious/noConsole: Logging error
|
|
49
|
+
console.error("Failed to download schema:", error);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<ButtonGroup>
|
|
55
|
+
<Button
|
|
56
|
+
variant="outline"
|
|
57
|
+
size="sm"
|
|
58
|
+
className="flex items-center gap-1.5"
|
|
59
|
+
asChild
|
|
60
|
+
>
|
|
61
|
+
<a href={downloadUrl} download onClick={handleDownload}>
|
|
62
|
+
<DownloadIcon size={14} />
|
|
63
|
+
Download schema
|
|
64
|
+
</a>
|
|
65
|
+
</Button>
|
|
66
|
+
<DropdownMenu>
|
|
67
|
+
<DropdownMenuTrigger asChild>
|
|
68
|
+
<Button size="sm" variant="outline" className="px-1.5">
|
|
69
|
+
<ChevronDownIcon size={14} />
|
|
70
|
+
</Button>
|
|
71
|
+
</DropdownMenuTrigger>
|
|
72
|
+
<DropdownMenuContent align="end">
|
|
73
|
+
<DropdownMenuItem asChild>
|
|
74
|
+
<a href={downloadUrl} target="_blank" rel="noopener noreferrer">
|
|
75
|
+
<ExternalLinkIcon size={14} />
|
|
76
|
+
Open in new tab
|
|
77
|
+
</a>
|
|
78
|
+
</DropdownMenuItem>
|
|
79
|
+
<DropdownMenuItem
|
|
80
|
+
onClick={async () => {
|
|
81
|
+
const response = await fetch(downloadUrl);
|
|
82
|
+
const schema = await response.text();
|
|
83
|
+
copyToClipboard(schema);
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
<CopyIcon size={14} />
|
|
87
|
+
Copy to clipboard
|
|
88
|
+
</DropdownMenuItem>
|
|
89
|
+
<DropdownMenuItem
|
|
90
|
+
onClick={() => {
|
|
91
|
+
const prompt = encodeURIComponent(
|
|
92
|
+
`Help me understand this API: ${new URL(downloadUrl, window.location.href).href}`,
|
|
93
|
+
);
|
|
94
|
+
window.open(`https://claude.ai/new?q=${prompt}`, "_blank");
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
<ClaudeLogo className="size-4" />
|
|
98
|
+
Use in Claude
|
|
99
|
+
</DropdownMenuItem>
|
|
100
|
+
<DropdownMenuItem
|
|
101
|
+
onClick={() => {
|
|
102
|
+
const prompt = encodeURIComponent(
|
|
103
|
+
`Help me understand this API: ${new URL(downloadUrl, window.location.href).href}`,
|
|
104
|
+
);
|
|
105
|
+
window.open(`https://chatgpt.com/?q=${prompt}`, "_blank");
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
<ChatGPTLogo className="size-4" />
|
|
109
|
+
Use in ChatGPT
|
|
110
|
+
</DropdownMenuItem>
|
|
111
|
+
</DropdownMenuContent>
|
|
112
|
+
</DropdownMenu>
|
|
113
|
+
</ButtonGroup>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
@@ -32,7 +32,7 @@ const CopyButton = ({ url }: { url: string }) => {
|
|
|
32
32
|
});
|
|
33
33
|
}}
|
|
34
34
|
variant="ghost"
|
|
35
|
-
size="icon"
|
|
35
|
+
size="icon-xs"
|
|
36
36
|
>
|
|
37
37
|
{isCopied ? (
|
|
38
38
|
<CheckIcon className="text-green-600" size={14} />
|
|
@@ -53,40 +53,33 @@ export const Endpoint = () => {
|
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
const { servers } = result.data.schema;
|
|
56
|
-
|
|
57
56
|
const firstServer = servers.at(0);
|
|
58
57
|
|
|
59
58
|
if (!firstServer) return null;
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
60
|
+
return (
|
|
61
|
+
<div className="flex items-center gap-1.5 flex-nowrap">
|
|
62
|
+
<span className="font-medium text-sm">Endpoint</span>
|
|
63
|
+
{servers.length > 1 ? (
|
|
64
|
+
<SimpleSelect
|
|
65
|
+
className="font-mono text-xs border-input bg-transparent dark:bg-input/30 dark:hover:bg-input/50 py-1.5 max-w-[450px] truncate"
|
|
66
|
+
onChange={(e) =>
|
|
67
|
+
startTransition(() => setSelectedServer(e.target.value))
|
|
68
|
+
}
|
|
69
|
+
value={selectedServer}
|
|
70
|
+
showChevrons={servers.length > 1}
|
|
71
|
+
options={servers.map((server) => ({
|
|
72
|
+
value: server.url,
|
|
73
|
+
label: server.url,
|
|
74
|
+
}))}
|
|
75
|
+
/>
|
|
76
|
+
) : (
|
|
65
77
|
<InlineCode className="text-xs px-2 py-1.5" selectOnClick>
|
|
66
78
|
{firstServer.url}
|
|
67
79
|
</InlineCode>
|
|
68
|
-
|
|
69
|
-
</div>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<div className="flex flex-wrap items-center gap-2">
|
|
75
|
-
<span className="font-medium text-sm">Endpoint</span>
|
|
80
|
+
)}
|
|
76
81
|
|
|
77
|
-
<
|
|
78
|
-
className="font-mono text-xs bg-border/50 dark:bg-border/70 py-1.5 max-w-[450px] truncate"
|
|
79
|
-
onChange={(e) =>
|
|
80
|
-
startTransition(() => setSelectedServer(e.target.value))
|
|
81
|
-
}
|
|
82
|
-
value={selectedServer}
|
|
83
|
-
showChevrons={servers.length > 1}
|
|
84
|
-
options={servers.map((server) => ({
|
|
85
|
-
value: server.url,
|
|
86
|
-
label: server.url,
|
|
87
|
-
}))}
|
|
88
|
-
/>
|
|
89
|
-
<CopyButton url={selectedServer} />
|
|
82
|
+
<CopyButton url={servers.length > 1 ? selectedServer : firstServer.url} />
|
|
90
83
|
</div>
|
|
91
84
|
);
|
|
92
85
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { Outlet } from "react-router";
|
|
3
|
-
import {
|
|
3
|
+
import { joinUrl } from "../../util/joinUrl.js";
|
|
4
4
|
import type { GraphQLClient } from "./client/GraphQLClient.js";
|
|
5
5
|
import { GraphQLProvider } from "./client/GraphQLContext.js";
|
|
6
6
|
import { OasConfigProvider } from "./context.js";
|
|
7
7
|
import type { OasPluginConfig } from "./interfaces.js";
|
|
8
|
-
import {
|
|
8
|
+
import { getVersionMetadata } from "./util/getRoutes.js";
|
|
9
9
|
|
|
10
10
|
export const OasProvider = ({
|
|
11
11
|
basePath,
|
|
@@ -19,25 +19,38 @@ export const OasProvider = ({
|
|
|
19
19
|
client: GraphQLClient;
|
|
20
20
|
}) => {
|
|
21
21
|
const value = useMemo(() => {
|
|
22
|
-
const versions =
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
const { versions: availableVersions, labels } = getVersionMetadata(config);
|
|
23
|
+
const currentVersion = version ?? availableVersions.at(0);
|
|
24
|
+
|
|
25
|
+
const versionLinks = Object.fromEntries(
|
|
26
|
+
availableVersions.map((id) => [
|
|
27
|
+
id,
|
|
28
|
+
{ path: joinUrl(basePath, id), label: labels[id] ?? id },
|
|
29
|
+
]),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const resolveInput = (): string | (() => Promise<unknown>) => {
|
|
33
|
+
if (!Array.isArray(config.input)) {
|
|
34
|
+
return config.input;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const versionConfig = currentVersion
|
|
38
|
+
? config.input.find((v) => v.path === currentVersion)
|
|
39
|
+
: config.input[0];
|
|
40
|
+
|
|
41
|
+
if (!versionConfig) {
|
|
42
|
+
throw new Error(`No input found for version: ${currentVersion}`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return versionConfig.input;
|
|
46
|
+
};
|
|
32
47
|
|
|
33
48
|
return {
|
|
34
49
|
config: {
|
|
35
50
|
...config,
|
|
36
|
-
version:
|
|
37
|
-
versions:
|
|
38
|
-
|
|
39
|
-
),
|
|
40
|
-
...input,
|
|
51
|
+
version: currentVersion,
|
|
52
|
+
versions: versionLinks,
|
|
53
|
+
input: resolveInput(),
|
|
41
54
|
},
|
|
42
55
|
};
|
|
43
56
|
}, [config, basePath, version]);
|