zudoku 0.44.1 → 0.45.1
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/cli.js +8 -2
- package/dist/app/entry.client.js +34 -21
- package/dist/app/entry.client.js.map +1 -1
- package/dist/app/main.js +7 -0
- package/dist/app/main.js.map +1 -1
- package/dist/config/validators/common.d.ts +420 -288
- package/dist/config/validators/common.js +10 -0
- package/dist/config/validators/common.js.map +1 -1
- package/dist/config/validators/validate.d.ts +161 -108
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/components/Footer.js +2 -2
- package/dist/lib/components/Footer.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/Markdown.d.ts +3 -1
- package/dist/lib/components/Markdown.js +8 -14
- package/dist/lib/components/Markdown.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +1 -1
- package/dist/lib/components/context/ZudokuContext.js +2 -3
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/index.d.ts +2 -1
- package/dist/lib/core/ZudokuContext.d.ts +8 -0
- package/dist/lib/core/ZudokuContext.js.map +1 -1
- package/dist/lib/errors/ErrorAlert.js +1 -1
- package/dist/lib/errors/ErrorAlert.js.map +1 -1
- package/dist/lib/oas/graphql/circular.js +23 -18
- package/dist/lib/oas/graphql/circular.js.map +1 -1
- package/dist/lib/oas/parser/index.d.ts +3 -0
- package/dist/lib/oas/parser/index.js +6 -1
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.js +1 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.js.map +1 -1
- package/dist/lib/plugins/openapi/ParamInfos.js +3 -1
- package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SidecarExamples.js +1 -1
- package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/IdentitySelector.js +1 -3
- package/dist/lib/plugins/openapi/playground/IdentitySelector.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js +4 -1
- package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +11 -12
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/utils.d.ts +5 -1
- package/dist/lib/plugins/openapi/schema/utils.js +9 -5
- package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.d.ts +1 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js +4 -0
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -1
- package/dist/lib/shiki.d.ts +35 -0
- package/dist/lib/shiki.js +103 -0
- package/dist/lib/shiki.js.map +1 -0
- package/dist/lib/ui/Callout.js +1 -1
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/ui/CodeBlock.d.ts +16 -0
- package/dist/lib/ui/CodeBlock.js +18 -0
- package/dist/lib/ui/CodeBlock.js.map +1 -0
- package/dist/lib/ui/SyntaxHighlight.d.ts +10 -15
- package/dist/lib/ui/SyntaxHighlight.js +12 -60
- package/dist/lib/ui/SyntaxHighlight.js.map +1 -1
- package/dist/lib/util/MdxComponents.d.ts +9 -3
- package/dist/lib/util/MdxComponents.js +9 -10
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/vite/api/SchemaManager.js +2 -0
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/config.js +34 -0
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugin-mdx.js +4 -11
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin-shiki-register.d.ts +3 -0
- package/dist/vite/plugin-shiki-register.js +38 -0
- package/dist/vite/plugin-shiki-register.js.map +1 -0
- package/dist/vite/plugin.js +2 -0
- package/dist/vite/plugin.js.map +1 -1
- package/lib/AuthenticationPlugin-BTJ37DKg.js +90 -0
- package/lib/{AuthenticationPlugin-BlJsiGuX.js.map → AuthenticationPlugin-BTJ37DKg.js.map} +1 -1
- package/lib/{Button-BBNrKpQd.js → Button-Bdk_Ij3U.js} +3 -3
- package/lib/{Button-BBNrKpQd.js.map → Button-Bdk_Ij3U.js.map} +1 -1
- package/lib/{Callout-D3Ja4OPX.js → Callout-XadUe37J.js} +12 -12
- package/lib/{Callout-D3Ja4OPX.js.map → Callout-XadUe37J.js.map} +1 -1
- package/lib/{Card-BtheiD7j.js → Card-BlCYNw5W.js} +2 -2
- package/lib/{Card-BtheiD7j.js.map → Card-BlCYNw5W.js.map} +1 -1
- package/lib/{CategoryHeading-D06WK_Wo.js → CategoryHeading-DZi-Szor.js} +2 -2
- package/lib/{CategoryHeading-D06WK_Wo.js.map → CategoryHeading-DZi-Szor.js.map} +1 -1
- package/lib/{Dialog-ByYz4ABw.js → Dialog-CNf2oWXG.js} +2 -2
- package/lib/{Dialog-ByYz4ABw.js.map → Dialog-CNf2oWXG.js.map} +1 -1
- package/lib/{Drawer-CEwbkLDb.js → Drawer-BPBxzel2.js} +25 -25
- package/lib/{Drawer-CEwbkLDb.js.map → Drawer-BPBxzel2.js.map} +1 -1
- package/lib/Markdown-D96AphCL.js +7691 -0
- package/lib/Markdown-D96AphCL.js.map +1 -0
- package/lib/MdxPage-tTTaDsLc.js +84 -0
- package/lib/{MdxPage-DlJaCSPf.js.map → MdxPage-tTTaDsLc.js.map} +1 -1
- package/lib/{OasProvider-CsUksaAo.js → OasProvider-DalHQixM.js} +4 -4
- package/lib/{OasProvider-CsUksaAo.js.map → OasProvider-DalHQixM.js.map} +1 -1
- package/lib/{OperationList-BlUBNsw2.js → OperationList-BB09ENaq.js} +1896 -1932
- package/lib/{OperationList-BlUBNsw2.js.map → OperationList-BB09ENaq.js.map} +1 -1
- package/lib/{Pagination-C5Fi7z_v.js → Pagination-CtmnJOJi.js} +4 -4
- package/lib/{Pagination-C5Fi7z_v.js.map → Pagination-CtmnJOJi.js.map} +1 -1
- package/lib/RouteGuard-lkdEJoDV.js +732 -0
- package/lib/{RouteGuard-D2gX29iI.js.map → RouteGuard-lkdEJoDV.js.map} +1 -1
- package/lib/{SchemaList-BQiBukIP.js → SchemaList-BH9bgMRw.js} +40 -41
- package/lib/{SchemaList-BQiBukIP.js.map → SchemaList-BH9bgMRw.js.map} +1 -1
- package/lib/{SchemaView-Bt95NiyQ.js → SchemaView-BsB7EFRl.js} +120 -115
- package/lib/SchemaView-BsB7EFRl.js.map +1 -0
- package/lib/Select-HTio1oSE.js +211 -0
- package/lib/{Select-CYaEBIYK.js.map → Select-HTio1oSE.js.map} +1 -1
- package/lib/SlotletProvider-CTgIBRWg.js +257 -0
- package/lib/SlotletProvider-CTgIBRWg.js.map +1 -0
- package/lib/SyntaxHighlight-UxOF1xNb.js +9107 -0
- package/lib/SyntaxHighlight-UxOF1xNb.js.map +1 -0
- package/lib/{Toc-BnN4zBb3.js → Toc-Ax54Pw8S.js} +3 -3
- package/lib/{Toc-BnN4zBb3.js.map → Toc-Ax54Pw8S.js.map} +1 -1
- package/lib/{chunk-BAXFHI7N-BLTsN6tl.js → chunk-BAXFHI7N-C9WnHsLV.js} +510 -517
- package/lib/{chunk-BAXFHI7N-BLTsN6tl.js.map → chunk-BAXFHI7N-C9WnHsLV.js.map} +1 -1
- package/lib/{circular-tOWjsgLZ.js → circular-CZaZtOBs.js} +1636 -1633
- package/lib/{circular-tOWjsgLZ.js.map → circular-CZaZtOBs.js.map} +1 -1
- package/lib/{cn-qaFjX9_3.js → cn-CwJPJKOE.js} +28 -29
- package/lib/{cn-qaFjX9_3.js.map → cn-CwJPJKOE.js.map} +1 -1
- package/lib/{createServer-XtO-PVox.js → createServer-DmqFeMgf.js} +3980 -3832
- package/lib/createServer-DmqFeMgf.js.map +1 -0
- package/lib/hook-BwOB_iZo.js +1442 -0
- package/lib/hook-BwOB_iZo.js.map +1 -0
- package/lib/{index-DwT-v3zK.js → index--oeBayMa.js} +2 -2
- package/lib/{index-DwT-v3zK.js.map → index--oeBayMa.js.map} +1 -1
- package/lib/index-BnT4-Efz.js +4975 -0
- package/lib/index-BnT4-Efz.js.map +1 -0
- package/lib/{index-LNp6rxyU.js → index-BvvmIczU.js} +2 -2
- package/lib/{index-LNp6rxyU.js.map → index-BvvmIczU.js.map} +1 -1
- package/lib/{index-CuBIgTKC.js → index-CrcNWbel.js} +9 -9
- package/lib/{index-CuBIgTKC.js.map → index-CrcNWbel.js.map} +1 -1
- package/lib/{index-CPNSgwSb.js → index-Z13x6tPX.js} +5 -5
- package/lib/{index-CPNSgwSb.js.map → index-Z13x6tPX.js.map} +1 -1
- package/lib/{index-CZnufgn5.js → index-sS7O9W-R.js} +899 -949
- package/lib/index-sS7O9W-R.js.map +1 -0
- package/lib/{index-DcHeSvkE.js → index-zddirpDj.js} +581 -609
- package/lib/{index-DcHeSvkE.js.map → index-zddirpDj.js.map} +1 -1
- package/lib/invariant-DAFpPywt.js +48 -0
- package/lib/{invariant-Caa8-XvF.js.map → invariant-DAFpPywt.js.map} +1 -1
- package/lib/mutation-CL2MCRQL.js +196 -0
- package/lib/{mutation-Bq5bn7Hf.js.map → mutation-CL2MCRQL.js.map} +1 -1
- package/lib/processors/removeParameters.js +27 -28
- package/lib/processors/removeParameters.js.map +1 -1
- package/lib/processors/removePaths.js +17 -17
- package/lib/processors/removePaths.js.map +1 -1
- package/lib/ui/Accordion.js +1 -1
- package/lib/ui/ActionButton.js +2 -2
- package/lib/ui/Alert.js +2 -2
- package/lib/ui/AlertDialog.js +1 -1
- package/lib/ui/Badge.js +2 -2
- package/lib/ui/Breadcrumb.js +1 -1
- package/lib/ui/Button.js +2 -2
- package/lib/ui/Callout.js +7 -7
- package/lib/ui/Callout.js.map +1 -1
- package/lib/ui/Card.js +1 -1
- package/lib/ui/Carousel.js +175 -175
- package/lib/ui/Carousel.js.map +1 -1
- package/lib/ui/Checkbox.js +1 -1
- package/lib/ui/CodeBlock.js +83 -0
- package/lib/ui/CodeBlock.js.map +1 -0
- package/lib/ui/Command.js +58 -58
- package/lib/ui/Command.js.map +1 -1
- package/lib/ui/Dialog.js +1 -1
- package/lib/ui/Drawer.js +2 -2
- package/lib/ui/DropdownMenu.js +1 -1
- package/lib/ui/Form.js +1 -1
- package/lib/ui/HoverCard.js +1 -1
- package/lib/ui/Input.js +1 -1
- package/lib/ui/Label.js +2 -2
- package/lib/ui/Pagination.js +1 -1
- package/lib/ui/Popover.js +1 -1
- package/lib/ui/Progress.js +1 -1
- package/lib/ui/RadioGroup.js +1 -1
- package/lib/ui/ScrollArea.js +1 -1
- package/lib/ui/Select.js +1 -1
- package/lib/ui/Skeleton.js +1 -1
- package/lib/ui/Slider.js +1 -1
- package/lib/ui/Switch.js +1 -1
- package/lib/ui/SyntaxHighlight.js +5 -6
- package/lib/ui/SyntaxHighlight.js.map +1 -1
- package/lib/ui/Tabs.js +1 -1
- package/lib/ui/Textarea.js +1 -1
- package/lib/ui/Toggle.js +2 -2
- package/lib/ui/ToggleGroup.js +1 -1
- package/lib/ui/Tooltip.js +1 -1
- package/lib/ui/util.js +1 -1
- package/lib/{useExposedProps-DmTJxEXG.js → useExposedProps-DG8J6ewJ.js} +2 -2
- package/lib/{useExposedProps-DmTJxEXG.js.map → useExposedProps-DG8J6ewJ.js.map} +1 -1
- package/lib/zudoku.auth-auth0.js +28 -31
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +64 -70
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +373 -382
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +7 -7
- package/lib/zudoku.hooks.js +2 -2
- package/lib/zudoku.plugin-api-catalog.js +45 -45
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +6 -6
- package/lib/zudoku.plugin-custom-pages.js +3 -3
- package/lib/zudoku.plugin-markdown.js +25 -28
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +3 -3
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/lib/zudoku.plugin-search-inkeep.js +26 -27
- package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +107 -110
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/package.json +39 -29
- package/src/app/entry.client.tsx +40 -25
- package/src/app/main.css +54 -3
- package/src/app/main.tsx +8 -0
- package/src/lib/components/Footer.tsx +3 -6
- package/src/lib/components/Header.tsx +1 -1
- package/src/lib/components/Markdown.tsx +29 -24
- package/src/lib/components/context/ZudokuContext.ts +2 -3
- package/src/lib/core/ZudokuContext.ts +5 -0
- package/src/lib/errors/ErrorAlert.tsx +1 -1
- package/src/lib/oas/graphql/circular.ts +27 -19
- package/src/lib/oas/parser/index.ts +6 -1
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +5 -2
- package/src/lib/plugins/openapi/ParamInfos.tsx +3 -1
- package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
- package/src/lib/plugins/openapi/SidecarExamples.tsx +2 -2
- package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +22 -35
- package/src/lib/plugins/openapi/schema/SchemaExampleAndDefault.tsx +5 -2
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +23 -17
- package/src/lib/plugins/openapi/schema/utils.ts +18 -6
- package/src/lib/plugins/openapi/util/generateSchemaExample.ts +6 -1
- package/src/lib/shiki.ts +133 -0
- package/src/lib/ui/Callout.tsx +1 -1
- package/src/lib/ui/CodeBlock.tsx +102 -0
- package/src/lib/ui/SyntaxHighlight.tsx +23 -182
- package/src/lib/util/MdxComponents.tsx +27 -14
- package/src/shiki/langs/abap.js +1 -0
- package/src/shiki/langs/actionscript-3.js +1 -0
- package/src/shiki/langs/ada.js +1 -0
- package/src/shiki/langs/angular-expression.js +1 -0
- package/src/shiki/langs/angular-html.js +1 -0
- package/src/shiki/langs/angular-inline-style.js +1 -0
- package/src/shiki/langs/angular-inline-template.js +1 -0
- package/src/shiki/langs/angular-let-declaration.js +1 -0
- package/src/shiki/langs/angular-template-blocks.js +1 -0
- package/src/shiki/langs/angular-template.js +1 -0
- package/src/shiki/langs/angular-ts.js +1 -0
- package/src/shiki/langs/apache.js +1 -0
- package/src/shiki/langs/apex.js +1 -0
- package/src/shiki/langs/apl.js +1 -0
- package/src/shiki/langs/applescript.js +1 -0
- package/src/shiki/langs/ara.js +1 -0
- package/src/shiki/langs/asciidoc.js +1 -0
- package/src/shiki/langs/asm.js +1 -0
- package/src/shiki/langs/astro.js +1 -0
- package/src/shiki/langs/awk.js +1 -0
- package/src/shiki/langs/ballerina.js +1 -0
- package/src/shiki/langs/bat.js +1 -0
- package/src/shiki/langs/beancount.js +1 -0
- package/src/shiki/langs/berry.js +1 -0
- package/src/shiki/langs/bibtex.js +1 -0
- package/src/shiki/langs/bicep.js +1 -0
- package/src/shiki/langs/blade.js +1 -0
- package/src/shiki/langs/bsl.js +1 -0
- package/src/shiki/langs/c.js +1 -0
- package/src/shiki/langs/cadence.js +1 -0
- package/src/shiki/langs/cairo.js +1 -0
- package/src/shiki/langs/clarity.js +1 -0
- package/src/shiki/langs/clojure.js +1 -0
- package/src/shiki/langs/cmake.js +1 -0
- package/src/shiki/langs/cobol.js +1 -0
- package/src/shiki/langs/codeowners.js +1 -0
- package/src/shiki/langs/codeql.js +1 -0
- package/src/shiki/langs/coffee.js +1 -0
- package/src/shiki/langs/common-lisp.js +1 -0
- package/src/shiki/langs/coq.js +1 -0
- package/src/shiki/langs/cpp-macro.js +1 -0
- package/src/shiki/langs/cpp.js +1 -0
- package/src/shiki/langs/crystal.js +1 -0
- package/src/shiki/langs/csharp.js +1 -0
- package/src/shiki/langs/css.js +1 -0
- package/src/shiki/langs/csv.js +1 -0
- package/src/shiki/langs/cue.js +1 -0
- package/src/shiki/langs/cypher.js +1 -0
- package/src/shiki/langs/d.js +1 -0
- package/src/shiki/langs/dart.js +1 -0
- package/src/shiki/langs/dax.js +1 -0
- package/src/shiki/langs/desktop.js +1 -0
- package/src/shiki/langs/diff.js +1 -0
- package/src/shiki/langs/docker.js +1 -0
- package/src/shiki/langs/dotenv.js +1 -0
- package/src/shiki/langs/dream-maker.js +1 -0
- package/src/shiki/langs/edge.js +1 -0
- package/src/shiki/langs/elixir.js +1 -0
- package/src/shiki/langs/elm.js +1 -0
- package/src/shiki/langs/emacs-lisp.js +1 -0
- package/src/shiki/langs/erb.js +1 -0
- package/src/shiki/langs/erlang.js +1 -0
- package/src/shiki/langs/es-tag-css.js +1 -0
- package/src/shiki/langs/es-tag-glsl.js +1 -0
- package/src/shiki/langs/es-tag-html.js +1 -0
- package/src/shiki/langs/es-tag-sql.js +1 -0
- package/src/shiki/langs/es-tag-xml.js +1 -0
- package/src/shiki/langs/fennel.js +1 -0
- package/src/shiki/langs/fish.js +1 -0
- package/src/shiki/langs/fluent.js +1 -0
- package/src/shiki/langs/fortran-fixed-form.js +1 -0
- package/src/shiki/langs/fortran-free-form.js +1 -0
- package/src/shiki/langs/fsharp.js +1 -0
- package/src/shiki/langs/gdresource.js +1 -0
- package/src/shiki/langs/gdscript.js +1 -0
- package/src/shiki/langs/gdshader.js +1 -0
- package/src/shiki/langs/genie.js +1 -0
- package/src/shiki/langs/gherkin.js +1 -0
- package/src/shiki/langs/git-commit.js +1 -0
- package/src/shiki/langs/git-rebase.js +1 -0
- package/src/shiki/langs/gleam.js +1 -0
- package/src/shiki/langs/glimmer-js.js +1 -0
- package/src/shiki/langs/glimmer-ts.js +1 -0
- package/src/shiki/langs/glsl.js +1 -0
- package/src/shiki/langs/gnuplot.js +1 -0
- package/src/shiki/langs/go.js +1 -0
- package/src/shiki/langs/graphql.js +1 -0
- package/src/shiki/langs/groovy.js +1 -0
- package/src/shiki/langs/hack.js +1 -0
- package/src/shiki/langs/haml.js +1 -0
- package/src/shiki/langs/handlebars.js +1 -0
- package/src/shiki/langs/haskell.js +1 -0
- package/src/shiki/langs/haxe.js +1 -0
- package/src/shiki/langs/hcl.js +1 -0
- package/src/shiki/langs/hjson.js +1 -0
- package/src/shiki/langs/hlsl.js +1 -0
- package/src/shiki/langs/html-derivative.js +1 -0
- package/src/shiki/langs/html.js +1 -0
- package/src/shiki/langs/http.js +1 -0
- package/src/shiki/langs/hxml.js +1 -0
- package/src/shiki/langs/hy.js +1 -0
- package/src/shiki/langs/imba.js +1 -0
- package/src/shiki/langs/ini.js +1 -0
- package/src/shiki/langs/java.js +1 -0
- package/src/shiki/langs/javascript.js +1 -0
- package/src/shiki/langs/jinja-html.js +1 -0
- package/src/shiki/langs/jinja.js +1 -0
- package/src/shiki/langs/jison.js +1 -0
- package/src/shiki/langs/json.js +1 -0
- package/src/shiki/langs/json5.js +1 -0
- package/src/shiki/langs/jsonc.js +1 -0
- package/src/shiki/langs/jsonl.js +1 -0
- package/src/shiki/langs/jsonnet.js +1 -0
- package/src/shiki/langs/jssm.js +1 -0
- package/src/shiki/langs/jsx.js +1 -0
- package/src/shiki/langs/julia.js +1 -0
- package/src/shiki/langs/kotlin.js +1 -0
- package/src/shiki/langs/kusto.js +1 -0
- package/src/shiki/langs/latex.js +1 -0
- package/src/shiki/langs/lean.js +1 -0
- package/src/shiki/langs/less.js +1 -0
- package/src/shiki/langs/liquid.js +1 -0
- package/src/shiki/langs/llvm.js +1 -0
- package/src/shiki/langs/log.js +1 -0
- package/src/shiki/langs/logo.js +1 -0
- package/src/shiki/langs/lua.js +1 -0
- package/src/shiki/langs/luau.js +1 -0
- package/src/shiki/langs/make.js +1 -0
- package/src/shiki/langs/markdown-vue.js +1 -0
- package/src/shiki/langs/markdown.js +1 -0
- package/src/shiki/langs/marko.js +1 -0
- package/src/shiki/langs/matlab.js +1 -0
- package/src/shiki/langs/mdc.js +1 -0
- package/src/shiki/langs/mdx.js +1 -0
- package/src/shiki/langs/mermaid.js +1 -0
- package/src/shiki/langs/mipsasm.js +1 -0
- package/src/shiki/langs/mojo.js +1 -0
- package/src/shiki/langs/move.js +1 -0
- package/src/shiki/langs/narrat.js +1 -0
- package/src/shiki/langs/nextflow.js +1 -0
- package/src/shiki/langs/nginx.js +1 -0
- package/src/shiki/langs/nim.js +1 -0
- package/src/shiki/langs/nix.js +1 -0
- package/src/shiki/langs/nushell.js +1 -0
- package/src/shiki/langs/objective-c.js +1 -0
- package/src/shiki/langs/objective-cpp.js +1 -0
- package/src/shiki/langs/ocaml.js +1 -0
- package/src/shiki/langs/pascal.js +1 -0
- package/src/shiki/langs/perl.js +1 -0
- package/src/shiki/langs/php.js +1 -0
- package/src/shiki/langs/plsql.js +1 -0
- package/src/shiki/langs/po.js +1 -0
- package/src/shiki/langs/polar.js +1 -0
- package/src/shiki/langs/postcss.js +1 -0
- package/src/shiki/langs/powerquery.js +1 -0
- package/src/shiki/langs/powershell.js +1 -0
- package/src/shiki/langs/prisma.js +1 -0
- package/src/shiki/langs/prolog.js +1 -0
- package/src/shiki/langs/proto.js +1 -0
- package/src/shiki/langs/pug.js +1 -0
- package/src/shiki/langs/puppet.js +1 -0
- package/src/shiki/langs/purescript.js +1 -0
- package/src/shiki/langs/python.js +1 -0
- package/src/shiki/langs/qml.js +1 -0
- package/src/shiki/langs/qmldir.js +1 -0
- package/src/shiki/langs/qss.js +1 -0
- package/src/shiki/langs/r.js +1 -0
- package/src/shiki/langs/racket.js +1 -0
- package/src/shiki/langs/raku.js +1 -0
- package/src/shiki/langs/razor.js +1 -0
- package/src/shiki/langs/reg.js +1 -0
- package/src/shiki/langs/regexp.js +1 -0
- package/src/shiki/langs/rel.js +1 -0
- package/src/shiki/langs/riscv.js +1 -0
- package/src/shiki/langs/rst.js +1 -0
- package/src/shiki/langs/ruby.js +1 -0
- package/src/shiki/langs/rust.js +1 -0
- package/src/shiki/langs/sas.js +1 -0
- package/src/shiki/langs/sass.js +1 -0
- package/src/shiki/langs/scala.js +1 -0
- package/src/shiki/langs/scheme.js +1 -0
- package/src/shiki/langs/scss.js +1 -0
- package/src/shiki/langs/sdbl.js +1 -0
- package/src/shiki/langs/shaderlab.js +1 -0
- package/src/shiki/langs/shellscript.js +1 -0
- package/src/shiki/langs/shellsession.js +1 -0
- package/src/shiki/langs/smalltalk.js +1 -0
- package/src/shiki/langs/solidity.js +1 -0
- package/src/shiki/langs/soy.js +1 -0
- package/src/shiki/langs/sparql.js +1 -0
- package/src/shiki/langs/splunk.js +1 -0
- package/src/shiki/langs/sql.js +1 -0
- package/src/shiki/langs/ssh-config.js +1 -0
- package/src/shiki/langs/stata.js +1 -0
- package/src/shiki/langs/stylus.js +1 -0
- package/src/shiki/langs/svelte.js +1 -0
- package/src/shiki/langs/swift.js +1 -0
- package/src/shiki/langs/system-verilog.js +1 -0
- package/src/shiki/langs/systemd.js +1 -0
- package/src/shiki/langs/talonscript.js +1 -0
- package/src/shiki/langs/tasl.js +1 -0
- package/src/shiki/langs/tcl.js +1 -0
- package/src/shiki/langs/templ.js +1 -0
- package/src/shiki/langs/terraform.js +1 -0
- package/src/shiki/langs/tex.js +1 -0
- package/src/shiki/langs/toml.js +1 -0
- package/src/shiki/langs/ts-tags.js +1 -0
- package/src/shiki/langs/tsv.js +1 -0
- package/src/shiki/langs/tsx.js +1 -0
- package/src/shiki/langs/turtle.js +1 -0
- package/src/shiki/langs/twig.js +1 -0
- package/src/shiki/langs/typescript.js +1 -0
- package/src/shiki/langs/typespec.js +1 -0
- package/src/shiki/langs/typst.js +1 -0
- package/src/shiki/langs/v.js +1 -0
- package/src/shiki/langs/vala.js +1 -0
- package/src/shiki/langs/vb.js +1 -0
- package/src/shiki/langs/verilog.js +1 -0
- package/src/shiki/langs/vhdl.js +1 -0
- package/src/shiki/langs/viml.js +1 -0
- package/src/shiki/langs/vue-directives.js +1 -0
- package/src/shiki/langs/vue-html.js +1 -0
- package/src/shiki/langs/vue-interpolations.js +1 -0
- package/src/shiki/langs/vue-sfc-style-variable-injection.js +1 -0
- package/src/shiki/langs/vue.js +1 -0
- package/src/shiki/langs/vyper.js +1 -0
- package/src/shiki/langs/wasm.js +1 -0
- package/src/shiki/langs/wenyan.js +1 -0
- package/src/shiki/langs/wgsl.js +1 -0
- package/src/shiki/langs/wikitext.js +1 -0
- package/src/shiki/langs/wit.js +1 -0
- package/src/shiki/langs/wolfram.js +1 -0
- package/src/shiki/langs/xml.js +1 -0
- package/src/shiki/langs/xsl.js +1 -0
- package/src/shiki/langs/yaml.js +1 -0
- package/src/shiki/langs/zenscript.js +1 -0
- package/src/shiki/langs/zig.js +1 -0
- package/src/shiki/themes/andromeeda.js +1 -0
- package/src/shiki/themes/aurora-x.js +1 -0
- package/src/shiki/themes/ayu-dark.js +1 -0
- package/src/shiki/themes/catppuccin-frappe.js +1 -0
- package/src/shiki/themes/catppuccin-latte.js +1 -0
- package/src/shiki/themes/catppuccin-macchiato.js +1 -0
- package/src/shiki/themes/catppuccin-mocha.js +1 -0
- package/src/shiki/themes/dark-plus.js +1 -0
- package/src/shiki/themes/dracula-soft.js +1 -0
- package/src/shiki/themes/dracula.js +1 -0
- package/src/shiki/themes/everforest-dark.js +1 -0
- package/src/shiki/themes/everforest-light.js +1 -0
- package/src/shiki/themes/github-dark-default.js +1 -0
- package/src/shiki/themes/github-dark-dimmed.js +1 -0
- package/src/shiki/themes/github-dark-high-contrast.js +1 -0
- package/src/shiki/themes/github-dark.js +1 -0
- package/src/shiki/themes/github-light-default.js +1 -0
- package/src/shiki/themes/github-light-high-contrast.js +1 -0
- package/src/shiki/themes/github-light.js +1 -0
- package/src/shiki/themes/gruvbox-dark-hard.js +1 -0
- package/src/shiki/themes/gruvbox-dark-medium.js +1 -0
- package/src/shiki/themes/gruvbox-dark-soft.js +1 -0
- package/src/shiki/themes/gruvbox-light-hard.js +1 -0
- package/src/shiki/themes/gruvbox-light-medium.js +1 -0
- package/src/shiki/themes/gruvbox-light-soft.js +1 -0
- package/src/shiki/themes/houston.js +1 -0
- package/src/shiki/themes/kanagawa-dragon.js +1 -0
- package/src/shiki/themes/kanagawa-lotus.js +1 -0
- package/src/shiki/themes/kanagawa-wave.js +1 -0
- package/src/shiki/themes/laserwave.js +1 -0
- package/src/shiki/themes/light-plus.js +1 -0
- package/src/shiki/themes/material-theme-darker.js +1 -0
- package/src/shiki/themes/material-theme-lighter.js +1 -0
- package/src/shiki/themes/material-theme-ocean.js +1 -0
- package/src/shiki/themes/material-theme-palenight.js +1 -0
- package/src/shiki/themes/material-theme.js +1 -0
- package/src/shiki/themes/min-dark.js +1 -0
- package/src/shiki/themes/min-light.js +1 -0
- package/src/shiki/themes/monokai.js +1 -0
- package/src/shiki/themes/night-owl.js +1 -0
- package/src/shiki/themes/nord.js +1 -0
- package/src/shiki/themes/one-dark-pro.js +1 -0
- package/src/shiki/themes/one-light.js +1 -0
- package/src/shiki/themes/plastic.js +1 -0
- package/src/shiki/themes/poimandres.js +1 -0
- package/src/shiki/themes/red.js +1 -0
- package/src/shiki/themes/rose-pine-dawn.js +1 -0
- package/src/shiki/themes/rose-pine-moon.js +1 -0
- package/src/shiki/themes/rose-pine.js +1 -0
- package/src/shiki/themes/slack-dark.js +1 -0
- package/src/shiki/themes/slack-ochin.js +1 -0
- package/src/shiki/themes/snazzy-light.js +1 -0
- package/src/shiki/themes/solarized-dark.js +1 -0
- package/src/shiki/themes/solarized-light.js +1 -0
- package/src/shiki/themes/synthwave-84.js +1 -0
- package/src/shiki/themes/tokyo-night.js +1 -0
- package/src/shiki/themes/vesper.js +1 -0
- package/src/shiki/themes/vitesse-black.js +1 -0
- package/src/shiki/themes/vitesse-dark.js +1 -0
- package/src/shiki/themes/vitesse-light.js +1 -0
- package/lib/AuthenticationPlugin-BlJsiGuX.js +0 -99
- package/lib/Markdown-DvdVn1O7.js +0 -17128
- package/lib/Markdown-DvdVn1O7.js.map +0 -1
- package/lib/MdxPage-DlJaCSPf.js +0 -85
- package/lib/RouteGuard-D2gX29iI.js +0 -744
- package/lib/SchemaView-Bt95NiyQ.js.map +0 -1
- package/lib/Select-CYaEBIYK.js +0 -223
- package/lib/SlotletProvider-wWbHYqWf.js +0 -340
- package/lib/SlotletProvider-wWbHYqWf.js.map +0 -1
- package/lib/SyntaxHighlight-o7q0acut.js +0 -2890
- package/lib/SyntaxHighlight-o7q0acut.js.map +0 -1
- package/lib/_commonjsHelpers-B4e78b8K.js +0 -29
- package/lib/_commonjsHelpers-B4e78b8K.js.map +0 -1
- package/lib/createServer-XtO-PVox.js.map +0 -1
- package/lib/hook-8GM2HXNM.js +0 -1478
- package/lib/hook-8GM2HXNM.js.map +0 -1
- package/lib/index-CZnufgn5.js.map +0 -1
- package/lib/index-CzUOM_vE.js +0 -5039
- package/lib/index-CzUOM_vE.js.map +0 -1
- package/lib/invariant-Caa8-XvF.js +0 -26
- package/lib/mutation-Bq5bn7Hf.js +0 -211
- package/lib/prism-bash.min-HHIMdNJ_.js +0 -7
- package/lib/prism-bash.min-HHIMdNJ_.js.map +0 -1
- package/lib/prism-csharp.min-C43x1RY2.js +0 -63
- package/lib/prism-csharp.min-C43x1RY2.js.map +0 -1
- package/lib/prism-java.min-CQzr40NQ.js +0 -35
- package/lib/prism-java.min-CQzr40NQ.js.map +0 -1
- package/lib/prism-javascript.min-CEqHqgbm.js +0 -9
- package/lib/prism-javascript.min-CEqHqgbm.js.map +0 -1
- package/lib/prism-json.min-B1GJqK1k.js +0 -2
- package/lib/prism-json.min-B1GJqK1k.js.map +0 -1
- package/lib/prism-jsstacktrace.min-BfobCF2F.js +0 -2
- package/lib/prism-jsstacktrace.min-BfobCF2F.js.map +0 -1
- package/lib/prism-markdown.min-C0Qn0m-5.js +0 -61
- package/lib/prism-markdown.min-C0Qn0m-5.js.map +0 -1
- package/lib/prism-markup-BNGj0Tvm.js +0 -174
- package/lib/prism-markup-BNGj0Tvm.js.map +0 -1
- package/lib/prism-objectivec.min-BXSWqpJJ.js +0 -2
- package/lib/prism-objectivec.min-BXSWqpJJ.js.map +0 -1
- package/lib/prism-ruby.min-L9OdQ6tU.js +0 -38
- package/lib/prism-ruby.min-L9OdQ6tU.js.map +0 -1
- package/lib/prism-typescript.min-qTySPvCh.js +0 -34
- package/lib/prism-typescript.min-qTySPvCh.js.map +0 -1
|
@@ -15,7 +15,9 @@ import { LogicalGroup } from "./LogicalGroup/LogicalGroup.js";
|
|
|
15
15
|
import { SchemaExampleAndDefault } from "./SchemaExampleAndDefault.js";
|
|
16
16
|
import { SchemaView } from "./SchemaView.js";
|
|
17
17
|
import {
|
|
18
|
+
extractCircularRefInfo,
|
|
18
19
|
hasLogicalGroupings,
|
|
20
|
+
isArrayCircularRef,
|
|
19
21
|
isArrayType,
|
|
20
22
|
isCircularRef,
|
|
21
23
|
isComplexType,
|
|
@@ -40,13 +42,13 @@ export const SchemaLogicalGroup = ({ schema }: { schema: SchemaObject }) => {
|
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
|
|
43
|
-
const RecursiveIndicator = () => (
|
|
45
|
+
const RecursiveIndicator = ({ circularProp }: { circularProp?: string }) => (
|
|
44
46
|
<InlineCode
|
|
45
47
|
className="inline-flex items-center gap-1.5 italic text-xs translate-y-0.5"
|
|
46
48
|
selectOnClick={false}
|
|
47
49
|
>
|
|
48
50
|
<RefreshCcwDotIcon size={13} />
|
|
49
|
-
<span>circular</span>
|
|
51
|
+
<span>{circularProp ? `${circularProp} (circular)` : "circular"}</span>
|
|
50
52
|
</InlineCode>
|
|
51
53
|
);
|
|
52
54
|
|
|
@@ -82,6 +84,16 @@ export const SchemaPropertyItem = ({
|
|
|
82
84
|
);
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
const isCollapsible = Boolean(
|
|
88
|
+
(hasLogicalGroupings(schema) ||
|
|
89
|
+
isComplexType(schema) ||
|
|
90
|
+
(isArrayType(schema) &&
|
|
91
|
+
"items" in schema &&
|
|
92
|
+
isComplexType(schema.items)) ||
|
|
93
|
+
schema.additionalProperties) &&
|
|
94
|
+
!isArrayCircularRef(schema),
|
|
95
|
+
);
|
|
96
|
+
|
|
85
97
|
return (
|
|
86
98
|
<li className="p-4 bg-border/20 hover:bg-border/30">
|
|
87
99
|
<div className="flex flex-col gap-2.5 justify-between text-sm">
|
|
@@ -95,9 +107,11 @@ export const SchemaPropertyItem = ({
|
|
|
95
107
|
group !== "optional" && (
|
|
96
108
|
<span className="text-primary">required</span>
|
|
97
109
|
),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
isArrayCircularRef(schema) && (
|
|
111
|
+
<RecursiveIndicator
|
|
112
|
+
circularProp={extractCircularRefInfo(schema.items)}
|
|
113
|
+
/>
|
|
114
|
+
),
|
|
101
115
|
]}
|
|
102
116
|
/>
|
|
103
117
|
</div>
|
|
@@ -113,10 +127,7 @@ export const SchemaPropertyItem = ({
|
|
|
113
127
|
{schema.const && <ConstValue schema={schema} hideDescription />}
|
|
114
128
|
{schema.enum && <EnumValues values={schema.enum} />}
|
|
115
129
|
<SchemaExampleAndDefault schema={schema} />
|
|
116
|
-
{(
|
|
117
|
-
isComplexType(schema) ||
|
|
118
|
-
isArrayType(schema) ||
|
|
119
|
-
schema.additionalProperties) && (
|
|
130
|
+
{isCollapsible && (
|
|
120
131
|
<Collapsible.Root
|
|
121
132
|
defaultOpen={defaultOpen}
|
|
122
133
|
open={isOpen}
|
|
@@ -136,14 +147,9 @@ export const SchemaPropertyItem = ({
|
|
|
136
147
|
<SchemaLogicalGroup schema={schema} />
|
|
137
148
|
) : schema.type === "object" ? (
|
|
138
149
|
<SchemaView schema={schema} />
|
|
139
|
-
) : (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
typeof schema.items === "object" &&
|
|
143
|
-
!isCircularRef(schema.items) && (
|
|
144
|
-
<SchemaView schema={schema.items} />
|
|
145
|
-
)
|
|
146
|
-
)}
|
|
150
|
+
) : isArrayType(schema) && "items" in schema ? (
|
|
151
|
+
<SchemaView schema={schema.items} />
|
|
152
|
+
) : null}
|
|
147
153
|
</div>
|
|
148
154
|
</Collapsible.Content>
|
|
149
155
|
</Collapsible.Root>
|
|
@@ -12,11 +12,13 @@ export const isArrayType = (value: SchemaObject) =>
|
|
|
12
12
|
// schema.type might be an array of types, so we need to check if "array" is one of them
|
|
13
13
|
(Array.isArray(value.type) && value.type.includes("array"));
|
|
14
14
|
|
|
15
|
-
export const isComplexType = (value
|
|
16
|
-
|
|
17
|
-
(value.type === "
|
|
18
|
-
|
|
19
|
-
(
|
|
15
|
+
export const isComplexType = (value?: SchemaObject) =>
|
|
16
|
+
value &&
|
|
17
|
+
((value.type === "object" &&
|
|
18
|
+
Object.keys(value.properties ?? {}).length > 0) ||
|
|
19
|
+
(value.type === "array" &&
|
|
20
|
+
typeof value.items === "object" &&
|
|
21
|
+
(!value.items.type || value.items.type === "object")));
|
|
20
22
|
|
|
21
23
|
export const hasLogicalGroupings = (value: SchemaObject) =>
|
|
22
24
|
Boolean(value.oneOf ?? value.allOf ?? value.anyOf);
|
|
@@ -30,4 +32,14 @@ export const LogicalSchemaTypeMap = {
|
|
|
30
32
|
export type LogicalGroupType = "AND" | "OR" | "ONE";
|
|
31
33
|
|
|
32
34
|
export const isCircularRef = (schema: unknown): schema is string =>
|
|
33
|
-
schema === CIRCULAR_REF;
|
|
35
|
+
typeof schema === "string" && schema.startsWith(CIRCULAR_REF);
|
|
36
|
+
|
|
37
|
+
export const isArrayCircularRef = (
|
|
38
|
+
schema: SchemaObject,
|
|
39
|
+
): schema is SchemaObject & { items: SchemaObject } =>
|
|
40
|
+
isArrayType(schema) && "items" in schema && isCircularRef(schema.items);
|
|
41
|
+
|
|
42
|
+
export const extractCircularRefInfo = (
|
|
43
|
+
ref?: string | SchemaObject,
|
|
44
|
+
): string | undefined =>
|
|
45
|
+
typeof ref === "string" ? ref.split(":")[1] : undefined;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { type SchemaObject } from "../../../oas/graphql/index.js";
|
|
2
|
+
import { isCircularRef } from "../schema/utils.js";
|
|
2
3
|
|
|
3
4
|
export const generateSchemaExample = (
|
|
4
|
-
schema
|
|
5
|
+
schema?: SchemaObject,
|
|
5
6
|
name?: string,
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
8
|
): any => {
|
|
9
|
+
if (!schema || isCircularRef(schema)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
// Check for schema-level example first
|
|
9
14
|
if (schema.example !== undefined) {
|
|
10
15
|
return schema.example;
|
package/src/lib/shiki.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import rehypeShikiFromHighlighter, {
|
|
2
|
+
type RehypeShikiCoreOptions,
|
|
3
|
+
} from "@shikijs/rehype/core";
|
|
4
|
+
import {
|
|
5
|
+
transformerMetaHighlight,
|
|
6
|
+
transformerMetaWordHighlight,
|
|
7
|
+
} from "@shikijs/transformers";
|
|
8
|
+
import type { Root } from "hast";
|
|
9
|
+
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
10
|
+
import { Fragment, type JSX } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import type { BundledLanguage, BundledTheme, HighlighterCore } from "shiki";
|
|
13
|
+
import { createHighlighterCore } from "shiki/core";
|
|
14
|
+
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
|
|
15
|
+
import type { Pluggable } from "unified";
|
|
16
|
+
import { visit } from "unist-util-visit";
|
|
17
|
+
import { cn } from "./util/cn.js";
|
|
18
|
+
|
|
19
|
+
const engine = createJavaScriptRegexEngine({ forgiving: true });
|
|
20
|
+
export const highlighter = await createHighlighterCore({
|
|
21
|
+
engine,
|
|
22
|
+
langAlias: {
|
|
23
|
+
markup: "html",
|
|
24
|
+
svg: "xml",
|
|
25
|
+
mathml: "xml",
|
|
26
|
+
atom: "xml",
|
|
27
|
+
ssml: "xml",
|
|
28
|
+
rss: "xml",
|
|
29
|
+
webmanifest: "json",
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const defaultHighlightOptions = {
|
|
34
|
+
themes: {
|
|
35
|
+
light: "github-light",
|
|
36
|
+
dark: "github-dark",
|
|
37
|
+
} satisfies { light: BundledTheme; dark: BundledTheme },
|
|
38
|
+
defaultColor: false,
|
|
39
|
+
inline: "tailing-curly-colon",
|
|
40
|
+
addLanguageClass: true,
|
|
41
|
+
transformers: [transformerMetaHighlight(), transformerMetaWordHighlight()],
|
|
42
|
+
parseMetaString: (str) => {
|
|
43
|
+
// Matches key="value", key=value, or key attributes
|
|
44
|
+
const matches = str.matchAll(
|
|
45
|
+
/([a-z0-9]+)(?:=(["'])(.*?)\2|=(.*?)(?:\s|$)|(?:\s|$))/gi,
|
|
46
|
+
);
|
|
47
|
+
return Object.fromEntries(
|
|
48
|
+
Array.from(matches).map((match) => {
|
|
49
|
+
const key = match[1];
|
|
50
|
+
const value = match[3] || match[4] || true;
|
|
51
|
+
return [key, value];
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
} satisfies RehypeShikiCoreOptions;
|
|
56
|
+
|
|
57
|
+
export const defaultLanguages: BundledLanguage[] = [
|
|
58
|
+
"shellscript",
|
|
59
|
+
"javascript",
|
|
60
|
+
"jsx",
|
|
61
|
+
"typescript",
|
|
62
|
+
"tsx",
|
|
63
|
+
"json",
|
|
64
|
+
"python",
|
|
65
|
+
"java",
|
|
66
|
+
"go",
|
|
67
|
+
"csharp",
|
|
68
|
+
"kotlin",
|
|
69
|
+
"objective-c",
|
|
70
|
+
"php",
|
|
71
|
+
"ruby",
|
|
72
|
+
"swift",
|
|
73
|
+
"css",
|
|
74
|
+
"html",
|
|
75
|
+
"xml",
|
|
76
|
+
"yaml",
|
|
77
|
+
"markdown",
|
|
78
|
+
"mdx",
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
const rehypeCodeBlockPlugin = () => (tree: Root) => {
|
|
82
|
+
visit(tree, "element", (node, _index, parent) => {
|
|
83
|
+
if (node.tagName !== "code") return;
|
|
84
|
+
|
|
85
|
+
const isCodeBlock = parent?.type === "element" && parent.tagName === "pre";
|
|
86
|
+
node.properties.inline = JSON.stringify(!isCodeBlock);
|
|
87
|
+
|
|
88
|
+
// Pass through properties from <pre> to <code> so we can handle it in `code` only
|
|
89
|
+
if (isCodeBlock) {
|
|
90
|
+
node.properties = {
|
|
91
|
+
...node.properties,
|
|
92
|
+
...structuredClone(parent.properties),
|
|
93
|
+
class: cn(node.properties.class, parent.properties.class),
|
|
94
|
+
};
|
|
95
|
+
parent.properties = {};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const createConfiguredShikiRehypePlugins = (themes?: {
|
|
101
|
+
light: BundledTheme;
|
|
102
|
+
dark: BundledTheme;
|
|
103
|
+
}) => {
|
|
104
|
+
return [
|
|
105
|
+
[
|
|
106
|
+
rehypeShikiFromHighlighter,
|
|
107
|
+
highlighter,
|
|
108
|
+
{
|
|
109
|
+
...defaultHighlightOptions,
|
|
110
|
+
themes: themes ?? defaultHighlightOptions.themes,
|
|
111
|
+
} satisfies RehypeShikiCoreOptions,
|
|
112
|
+
] satisfies Pluggable,
|
|
113
|
+
rehypeCodeBlockPlugin,
|
|
114
|
+
];
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const highlight = (
|
|
118
|
+
highlighter: HighlighterCore,
|
|
119
|
+
code: string,
|
|
120
|
+
lang = "text",
|
|
121
|
+
themes: {
|
|
122
|
+
light: BundledTheme;
|
|
123
|
+
dark: BundledTheme;
|
|
124
|
+
} = defaultHighlightOptions.themes,
|
|
125
|
+
) => {
|
|
126
|
+
const value = highlighter.codeToHast(code, {
|
|
127
|
+
lang,
|
|
128
|
+
...defaultHighlightOptions,
|
|
129
|
+
themes,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return toJsxRuntime(value, { Fragment, jsx, jsxs }) as JSX.Element;
|
|
133
|
+
};
|
package/src/lib/ui/Callout.tsx
CHANGED
|
@@ -77,7 +77,7 @@ export const Callout = ({
|
|
|
77
77
|
"grid grid-cols-[min-content_1fr] items-baseline grid-rows-[fit-content_1fr] gap-x-4 gap-y-2",
|
|
78
78
|
!icon && title && "flex flex-col gap-2",
|
|
79
79
|
"[&_a]:underline [&_a]:decoration-current [&_a]:decoration-from-font [&_a]:underline-offset-4 hover:[&_a]:decoration-1",
|
|
80
|
-
"[&
|
|
80
|
+
"[&_.code-block-wrapper]:border",
|
|
81
81
|
"[&_ul]:list-disc [&_ol]:list-decimal [&_ul]:ps-4 [&_ul>li]:ps-1 [&_ul>li]:my-1",
|
|
82
82
|
icon && title && "items-center",
|
|
83
83
|
border,
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { cn } from "../util/cn.js";
|
|
5
|
+
|
|
6
|
+
export type CodeBlockProps = {
|
|
7
|
+
className?: string;
|
|
8
|
+
noBackground?: boolean;
|
|
9
|
+
wrapLines?: boolean;
|
|
10
|
+
showLanguageIndicator?: boolean;
|
|
11
|
+
language?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
code?: ReactNode;
|
|
15
|
+
showCopy?: "hover" | "always" | "never";
|
|
16
|
+
showCopyText?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
showLineNumbers?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const CodeBlock = ({
|
|
22
|
+
children,
|
|
23
|
+
title,
|
|
24
|
+
language,
|
|
25
|
+
showCopy = "hover",
|
|
26
|
+
showCopyText,
|
|
27
|
+
showLanguageIndicator = true,
|
|
28
|
+
showLineNumbers,
|
|
29
|
+
...props
|
|
30
|
+
}: CodeBlockProps) => {
|
|
31
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
32
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
33
|
+
|
|
34
|
+
if (!children) return null;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={cn(
|
|
39
|
+
"code-block-wrapper relative group bg-muted/50 rounded-md",
|
|
40
|
+
showLineNumbers && "line-numbers",
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
{title && (
|
|
44
|
+
<div className="text-xs text-muted-foreground top-2 font-mono border-b w-full py-2 px-4 ">
|
|
45
|
+
{title}
|
|
46
|
+
</div>
|
|
47
|
+
)}
|
|
48
|
+
<div
|
|
49
|
+
className={cn(
|
|
50
|
+
"code-block text-sm not-prose scrollbar overflow-x-auto scrollbar p-4",
|
|
51
|
+
props.className,
|
|
52
|
+
)}
|
|
53
|
+
ref={ref}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</div>
|
|
57
|
+
{showLanguageIndicator && (
|
|
58
|
+
<span
|
|
59
|
+
className={cn(
|
|
60
|
+
"absolute top-1.5 end-3 !text-[11px] font-mono text-muted-foreground transition group-hover:opacity-0",
|
|
61
|
+
title && "top-12",
|
|
62
|
+
)}
|
|
63
|
+
>
|
|
64
|
+
{language}
|
|
65
|
+
</span>
|
|
66
|
+
)}
|
|
67
|
+
{showCopy !== "never" && (
|
|
68
|
+
<button
|
|
69
|
+
type="button"
|
|
70
|
+
aria-label="Copy code"
|
|
71
|
+
title="Copy code"
|
|
72
|
+
className={cn(
|
|
73
|
+
"absolute top-2 end-2 p-2 hover:outline hover:outline-border/75 dark:hover:outline-border rounded-md text-sm text-muted-foreground transition",
|
|
74
|
+
title && "top-10",
|
|
75
|
+
showCopy === "hover" && "opacity-0 group-hover:opacity-100",
|
|
76
|
+
showCopyText && "flex gap-2 items-center font-medium",
|
|
77
|
+
)}
|
|
78
|
+
disabled={isCopied}
|
|
79
|
+
onClick={() => {
|
|
80
|
+
if (!ref.current?.textContent) return;
|
|
81
|
+
|
|
82
|
+
setIsCopied(true);
|
|
83
|
+
void navigator.clipboard.writeText(ref.current.textContent);
|
|
84
|
+
setTimeout(() => setIsCopied(false), 2000);
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
{isCopied ? (
|
|
88
|
+
<CheckIcon
|
|
89
|
+
className="text-emerald-600"
|
|
90
|
+
size={16}
|
|
91
|
+
strokeWidth={2.5}
|
|
92
|
+
absoluteStrokeWidth
|
|
93
|
+
/>
|
|
94
|
+
) : (
|
|
95
|
+
<CopyIcon size={16} />
|
|
96
|
+
)}
|
|
97
|
+
{showCopyText && "Copy"}
|
|
98
|
+
</button>
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
@@ -1,186 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// @ts-expect-error This is untyped
|
|
22
|
-
void import("prismjs/components/prism-csharp.min.js");
|
|
23
|
-
// @ts-expect-error This is untyped
|
|
24
|
-
void import("prismjs/components/prism-objectivec.min.js");
|
|
25
|
-
// @ts-expect-error This is untyped
|
|
26
|
-
void import("prismjs/components/prism-markdown.min.js");
|
|
27
|
-
// @ts-expect-error This is untyped
|
|
28
|
-
void import("prismjs/components/prism-javascript.min.js");
|
|
29
|
-
// @ts-expect-error This is untyped
|
|
30
|
-
void import("prismjs/components/prism-typescript.min.js");
|
|
31
|
-
// @ts-expect-error This is untyped
|
|
32
|
-
void import("prismjs/components/prism-jsstacktrace.min.js");
|
|
33
|
-
|
|
34
|
-
import { useTheme } from "next-themes";
|
|
35
|
-
import { memo, useState } from "react";
|
|
36
|
-
import { ClientOnly } from "../components/ClientOnly.js";
|
|
37
|
-
import { cn } from "../util/cn.js";
|
|
38
|
-
|
|
39
|
-
export type SyntaxHighlightProps = {
|
|
40
|
-
className?: string;
|
|
41
|
-
noBackground?: boolean;
|
|
42
|
-
wrapLines?: boolean;
|
|
43
|
-
showLanguageIndicator?: boolean;
|
|
44
|
-
language?: string;
|
|
45
|
-
title?: string;
|
|
46
|
-
children?: string;
|
|
47
|
-
code?: string;
|
|
48
|
-
showCopy?: "hover" | "always" | "never";
|
|
49
|
-
showCopyText?: boolean;
|
|
50
|
-
disabled?: boolean;
|
|
51
|
-
} & Omit<HighlightProps, "children" | "language">;
|
|
52
|
-
|
|
53
|
-
const remapLang = {
|
|
54
|
-
mdx: "md",
|
|
55
|
-
} as Record<string, string>;
|
|
56
|
-
|
|
57
|
-
const SyntaxHighlightInner = ({
|
|
58
|
-
language = "plain",
|
|
59
|
-
showCopy = "hover",
|
|
60
|
-
showCopyText,
|
|
61
|
-
title,
|
|
62
|
-
children,
|
|
63
|
-
disabled,
|
|
64
|
-
...props
|
|
65
|
-
}: SyntaxHighlightProps) => {
|
|
66
|
-
const { resolvedTheme } = useTheme();
|
|
67
|
-
const [isCopied, setIsCopied] = useState(false);
|
|
68
|
-
|
|
69
|
-
const code = children ?? props.code;
|
|
70
|
-
|
|
71
|
-
if (!code) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const highlightTheme =
|
|
76
|
-
resolvedTheme === "dark" ? themes.vsDark : themes.github;
|
|
77
|
-
|
|
78
|
-
// hardcoded values from the themes to avoid color flash in SSR
|
|
79
|
-
const themeColorClasses =
|
|
80
|
-
"bg-[#f6f8fa] text-[#393a34] dark:bg-[#1e1e1e] dark:text-[#9cdcfe]";
|
|
81
|
-
|
|
82
|
-
const Wrapper = ({
|
|
83
|
-
children,
|
|
84
|
-
className,
|
|
85
|
-
style,
|
|
86
|
-
}: {
|
|
87
|
-
children: React.ReactNode;
|
|
88
|
-
className?: string;
|
|
89
|
-
style?: React.CSSProperties;
|
|
90
|
-
}) => (
|
|
91
|
-
<div className="relative group">
|
|
92
|
-
{title && (
|
|
93
|
-
<div className="text-xs text-muted-foreground absolute top-2 font-mono border-b w-full pb-2 px-4 ">
|
|
94
|
-
{title}
|
|
95
|
-
</div>
|
|
96
|
-
)}
|
|
97
|
-
<pre
|
|
98
|
-
className={cn(
|
|
99
|
-
"relative scrollbar overflow-x-auto",
|
|
100
|
-
props.className,
|
|
101
|
-
props.noBackground ? "!bg-transparent" : themeColorClasses,
|
|
102
|
-
props.wrapLines && "whitespace-pre-wrap break-words",
|
|
103
|
-
title && "pt-10",
|
|
104
|
-
className,
|
|
105
|
-
)}
|
|
106
|
-
style={style}
|
|
107
|
-
>
|
|
108
|
-
{children}
|
|
109
|
-
</pre>
|
|
110
|
-
{props.showLanguageIndicator && (
|
|
111
|
-
<span className="absolute top-1.5 end-3 text-[11px] font-mono text-muted-foreground transition group-hover:opacity-0">
|
|
112
|
-
{language}
|
|
113
|
-
</span>
|
|
114
|
-
)}
|
|
115
|
-
{showCopy !== "never" && (
|
|
116
|
-
<button
|
|
117
|
-
type="button"
|
|
118
|
-
aria-label="Copy code"
|
|
119
|
-
title="Copy code"
|
|
120
|
-
className={cn(
|
|
121
|
-
"absolute top-2 end-2 p-2 hover:outline hover:outline-border/75 dark:hover:outline-border rounded-md text-sm text-muted-foreground transition",
|
|
122
|
-
showCopy === "hover"
|
|
123
|
-
? "opacity-0 group-hover:opacity-100 group-hover:bg-zinc-100 group-hover:dark:bg-zinc-700"
|
|
124
|
-
: "bg-zinc-100 dark:bg-zinc-700",
|
|
125
|
-
showCopyText && "flex gap-2 items-center font-medium",
|
|
126
|
-
)}
|
|
127
|
-
disabled={isCopied}
|
|
128
|
-
onClick={() => {
|
|
129
|
-
setIsCopied(true);
|
|
130
|
-
void navigator.clipboard.writeText(code);
|
|
131
|
-
setTimeout(() => setIsCopied(false), 2000);
|
|
132
|
-
}}
|
|
133
|
-
>
|
|
134
|
-
{isCopied ? (
|
|
135
|
-
<CheckIcon
|
|
136
|
-
className="text-emerald-600"
|
|
137
|
-
size={16}
|
|
138
|
-
strokeWidth={2.5}
|
|
139
|
-
absoluteStrokeWidth
|
|
140
|
-
/>
|
|
141
|
-
) : (
|
|
142
|
-
<CopyIcon size={16} />
|
|
143
|
-
)}
|
|
144
|
-
{showCopyText && "Copy"}
|
|
145
|
-
</button>
|
|
146
|
-
)}
|
|
147
|
-
</div>
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
if (disabled) {
|
|
151
|
-
return (
|
|
152
|
-
<ClientOnly fallback={<Wrapper>{code}</Wrapper>}>
|
|
153
|
-
<Wrapper>{code}</Wrapper>
|
|
154
|
-
</ClientOnly>
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { useZudoku } from "../components/context/ZudokuContext.js";
|
|
3
|
+
import { highlight } from "../shiki.js";
|
|
4
|
+
import invariant from "../util/invariant.js";
|
|
5
|
+
import { CodeBlock, type CodeBlockProps } from "./CodeBlock.js";
|
|
6
|
+
|
|
7
|
+
type SyntaxHighlightProps = CodeBlockProps &
|
|
8
|
+
({ code: string; children?: never } | { code?: never; children: string });
|
|
9
|
+
|
|
10
|
+
export const SyntaxHighlight = memo(
|
|
11
|
+
({ code, children, ...props }: SyntaxHighlightProps) => {
|
|
12
|
+
const { syntaxHighlighting } = useZudoku().options;
|
|
13
|
+
|
|
14
|
+
invariant(syntaxHighlighting?.highlighter, "Highlighter not found");
|
|
15
|
+
|
|
16
|
+
const highlightedCode = highlight(
|
|
17
|
+
syntaxHighlighting.highlighter,
|
|
18
|
+
code ?? children,
|
|
19
|
+
props.language,
|
|
20
|
+
syntaxHighlighting.themes,
|
|
155
21
|
);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return (
|
|
159
|
-
<ClientOnly fallback={<Wrapper>{code}</Wrapper>}>
|
|
160
|
-
<Highlight
|
|
161
|
-
theme={highlightTheme}
|
|
162
|
-
language={remapLang[language] ?? language}
|
|
163
|
-
{...props}
|
|
164
|
-
code={code}
|
|
165
|
-
>
|
|
166
|
-
{({ className, style, tokens, getLineProps, getTokenProps }) => (
|
|
167
|
-
<Wrapper className={className} style={style}>
|
|
168
|
-
{tokens.map((line, i) => (
|
|
169
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
170
|
-
<div key={i} {...getLineProps({ line })}>
|
|
171
|
-
{line.map((token, key) => (
|
|
172
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
173
|
-
<span key={key} {...getTokenProps({ token })} />
|
|
174
|
-
))}
|
|
175
|
-
</div>
|
|
176
|
-
))}
|
|
177
|
-
</Wrapper>
|
|
178
|
-
)}
|
|
179
|
-
</Highlight>
|
|
180
|
-
</ClientOnly>
|
|
181
|
-
);
|
|
182
|
-
};
|
|
183
22
|
|
|
184
|
-
|
|
23
|
+
return <CodeBlock {...props}>{highlightedCode}</CodeBlock>;
|
|
24
|
+
},
|
|
25
|
+
);
|
|
185
26
|
|
|
186
27
|
SyntaxHighlight.displayName = "SyntaxHighlight";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type MDXComponents } from "mdx/types.js";
|
|
2
|
+
import { CodeBlock } from "zudoku/ui/CodeBlock.js";
|
|
2
3
|
import { AnchorLink } from "../components/AnchorLink.js";
|
|
3
4
|
import { Heading } from "../components/Heading.js";
|
|
4
5
|
import { InlineCode } from "../components/InlineCode.js";
|
|
@@ -6,6 +7,7 @@ import { Button } from "../ui/Button.js";
|
|
|
6
7
|
import { Callout } from "../ui/Callout.js";
|
|
7
8
|
import { Stepper } from "../ui/Stepper.js";
|
|
8
9
|
import { SyntaxHighlight } from "../ui/SyntaxHighlight.js";
|
|
10
|
+
import { cn } from "./cn.js";
|
|
9
11
|
|
|
10
12
|
export type MdxComponentsType = Readonly<MDXComponents> | null | undefined;
|
|
11
13
|
|
|
@@ -62,26 +64,37 @@ export const MdxComponents = {
|
|
|
62
64
|
caution: (props) => <Callout type="caution" {...props} />,
|
|
63
65
|
warning: (props) => <Callout type="caution" {...props} />,
|
|
64
66
|
danger: (props) => <Callout type="danger" {...props} />,
|
|
65
|
-
pre: (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
pre: (props) => (
|
|
68
|
+
<pre className={cn("not-prose my-4", props.className)} {...props} />
|
|
69
|
+
),
|
|
70
|
+
code: ({
|
|
71
|
+
className,
|
|
72
|
+
node: _node,
|
|
73
|
+
children,
|
|
74
|
+
title,
|
|
75
|
+
inline,
|
|
76
|
+
showLineNumbers,
|
|
77
|
+
...props
|
|
78
|
+
}) => {
|
|
79
|
+
const match = className?.match(/language?-(\w+)/);
|
|
70
80
|
|
|
71
|
-
if (inline === true || inline ===
|
|
72
|
-
return
|
|
81
|
+
if (inline === "true" || inline === true) {
|
|
82
|
+
return (
|
|
83
|
+
<InlineCode className={cn(className, "inline")}>{children}</InlineCode>
|
|
84
|
+
);
|
|
73
85
|
}
|
|
74
86
|
|
|
75
|
-
const match = className?.match(/language?-(\w+)/);
|
|
76
|
-
|
|
77
87
|
return (
|
|
78
|
-
<
|
|
88
|
+
<CodeBlock
|
|
79
89
|
language={match?.[1]}
|
|
80
|
-
className="rounded-xl p-4 border dark:!bg-foreground/10 dark:border-transparent"
|
|
81
90
|
showLanguageIndicator
|
|
82
|
-
|
|
83
|
-
title={
|
|
84
|
-
|
|
91
|
+
showLineNumbers={showLineNumbers}
|
|
92
|
+
title={title}
|
|
93
|
+
>
|
|
94
|
+
<code className={cn(className, "not-inline")} {...props}>
|
|
95
|
+
{children}
|
|
96
|
+
</code>
|
|
97
|
+
</CodeBlock>
|
|
85
98
|
);
|
|
86
99
|
},
|
|
87
100
|
} satisfies MdxComponentsType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/abap";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/actionscript-3";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/ada";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/angular-expression";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/angular-html";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/angular-inline-style";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@shikijs/langs/angular-inline-template";
|