fumadocs-openapi 12.2.0 → 12.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/css/generated/shared.css +1 -1
  2. package/dist/.translations/index.d.ts +4 -4
  3. package/dist/.translations/keys.js +4 -4
  4. package/dist/operation.js +4 -4
  5. package/dist/packages/shared-api/dist/.translations/index.d.ts +1 -0
  6. package/dist/packages/shared-api/dist/.translations/keys.js +1 -0
  7. package/dist/packages/shared-api/dist/auto-anchor/index.js +54 -10
  8. package/dist/packages/shared-api/dist/components/accordion.js +3 -11
  9. package/dist/packages/shared-api/dist/components/collapsible.js +16 -0
  10. package/dist/packages/shared-api/dist/components/defaults.js +1 -1
  11. package/dist/packages/shared-api/dist/components/schema/client.d.ts +5 -0
  12. package/dist/packages/shared-api/dist/components/schema/client.js +408 -455
  13. package/dist/packages/shared-api/dist/components/select-tab.js +7 -12
  14. package/dist/playground/auth.d.ts +61 -7
  15. package/dist/playground/auth.js +192 -95
  16. package/dist/playground/fetcher.d.ts +1 -1
  17. package/dist/playground/index.d.ts +2 -2
  18. package/dist/playground/index.js +2 -2
  19. package/dist/playground/use-playground.d.ts +5 -3
  20. package/dist/playground/use-playground.js +22 -10
  21. package/dist/requests/generators/csharp.js +11 -21
  22. package/dist/requests/generators/curl.js +12 -14
  23. package/dist/requests/generators/go.js +22 -33
  24. package/dist/requests/generators/index.d.ts +1 -1
  25. package/dist/requests/generators/java.js +33 -37
  26. package/dist/requests/generators/javascript.js +13 -20
  27. package/dist/requests/generators/python.js +12 -17
  28. package/dist/requests/generators/rust.js +15 -20
  29. package/dist/requests/index.d.ts +1 -1
  30. package/dist/requests/media/adapter.d.ts +0 -1
  31. package/dist/requests/media/adapter.js +50 -42
  32. package/dist/requests/media/encode.d.ts +1 -1
  33. package/dist/requests/media/encode.js +1 -1
  34. package/dist/requests/string-utils.js +14 -6
  35. package/dist/ui/components/dialog.js +14 -0
  36. package/dist/ui/components/endpoint.js +11 -8
  37. package/dist/ui/components/heading.js +1 -1
  38. package/dist/ui/components/schema.js +1 -1
  39. package/dist/ui/{playground/components → components}/segmented.js +2 -2
  40. package/dist/ui/operation/index.js +262 -237
  41. package/dist/ui/operation/request-tabs.js +1 -1
  42. package/dist/ui/operation/response-tabs.js +1 -1
  43. package/dist/ui/operation/usage-tabs.js +1 -1
  44. package/dist/ui/playground/client.d.ts +1 -1
  45. package/dist/ui/playground/client.js +23 -19
  46. package/dist/ui/playground/components/fields.js +36 -15
  47. package/dist/ui/playground/components/oauth-panel.js +71 -21
  48. package/dist/ui/playground/components/request-panel.js +80 -94
  49. package/dist/ui/playground/components/response-panel.js +1 -1
  50. package/dist/ui/playground/components/result-display.js +1 -1
  51. package/dist/ui/playground/components/server-select.js +1 -1
  52. package/dist/utils/create-page.js +2 -2
  53. package/dist/utils/get-example-requests.js +1 -1
  54. package/dist/utils/use-server.d.ts +3 -3
  55. package/dist/utils/use-server.js +2 -2
  56. package/package.json +5 -5
  57. package/dist/packages/shared-api/dist/auto-anchor/client.js +0 -20
  58. package/dist/packages/shared-api/dist/components/popover.js +0 -23
  59. package/dist/packages/shared-api/dist/utils/merge-refs.js +0 -11
@@ -12,9 +12,9 @@ interface ServerContextType {
12
12
  /**
13
13
  * The URL of `pathname` on the selected server, with the server variables resolved.
14
14
  *
15
- * It is resolved against the page origin, which also serves the request when no server is
16
- * selected. On the server and during hydration the origin is unknown, so it is
17
- * `https://example.com`.
15
+ * Relative server URLs are resolved against the page origin, which also serves the request when
16
+ * no server is selected. On the server and during hydration the origin is unknown, so
17
+ * `https://example.com` takes its place.
18
18
  */
19
19
  resolveUrl: (pathname?: string) => string;
20
20
  setServer: (value: string) => void;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { useServerStore } from "../packages/shared-api/dist/utils/use-server-store.js";
3
2
  import { joinURL, resolveServerUrl } from "../packages/shared-api/dist/utils/url.js";
3
+ import { useServerStore } from "../packages/shared-api/dist/utils/use-server-store.js";
4
4
  import { createContext, use, useCallback, useMemo, useSyncExternalStore } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/utils/use-server.tsx
@@ -31,7 +31,7 @@ function ServerProvider({ servers, storageKeyPrefix, children }) {
31
31
  const { server } = store;
32
32
  const isClient = useSyncExternalStore(noop, () => true, () => false);
33
33
  const resolveUrl = useCallback((pathname = "") => {
34
- const base = isClient ? new URL(server ? resolveServerUrl(server.url, server.variables) : "/", window.location.origin).href : "https://example.com";
34
+ const base = new URL(server ? resolveServerUrl(server.url, server.variables) : "/", isClient ? window.location.origin : "https://example.com").href;
35
35
  return pathname ? joinURL(base, pathname) : base;
36
36
  }, [server, isClient]);
37
37
  return /* @__PURE__ */ jsx(ServerContext, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "12.2.0",
3
+ "version": "12.4.0",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "Docs",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@base-ui/react": "^1.8.0",
56
56
  "@fuma-translate/react": "^1.0.2",
57
- "@fumadocs/json-schema": "0.2.0",
57
+ "@fumadocs/json-schema": "0.3.0",
58
58
  "@fumari/json-schema-ts": "^1.0.2",
59
59
  "@fumari/stf": "1.1.1",
60
60
  "@scalar/json-magic": "^0.15.4",
@@ -78,10 +78,10 @@
78
78
  "@types/react-dom": "^19.3.0",
79
79
  "fast-content-type-parse": "^4.0.0",
80
80
  "fuma-cli": "^0.3.1",
81
- "fumadocs-core": "16.16.0",
82
- "fumadocs-ui": "npm:@fumadocs/base-ui@16.16.0",
81
+ "fumadocs-core": "16.17.0",
82
+ "fumadocs-ui": "npm:@fumadocs/base-ui@16.17.0",
83
83
  "json-schema-typed": "^8.0.2",
84
- "shared-api": "0.2.10",
84
+ "shared-api": "0.2.11",
85
85
  "tsconfig": "0.0.0",
86
86
  "tsdown": "0.23.0",
87
87
  "xml-js": "^1.6.11"
@@ -1,20 +0,0 @@
1
- "use client";
2
- import { anchorSegments } from "./index.js";
3
- import { createContext, use, useMemo } from "react";
4
- import { jsx } from "react/jsx-runtime";
5
- //#region ../shared-api/dist/auto-anchor/client.js
6
- const AnchorContext = createContext([]);
7
- /** Append segment to anchor IDs */
8
- function AnchorSection({ segments, children }) {
9
- const v = use(AnchorContext);
10
- return /* @__PURE__ */ jsx(AnchorContext, {
11
- value: useMemo(() => [...v, ...segments], [v, segments]),
12
- children
13
- });
14
- }
15
- function useAnchorId(segments) {
16
- if (!segments) return null;
17
- return anchorSegments(...use(AnchorContext), ...segments);
18
- }
19
- //#endregion
20
- export { AnchorSection, useAnchorId };
@@ -1,23 +0,0 @@
1
- "use client";
2
- import { cn } from "../utils/cn.js";
3
- import "react";
4
- import { jsx } from "react/jsx-runtime";
5
- import { Popover } from "@base-ui/react/popover";
6
- //#region ../shared-api/dist/components/popover.js
7
- const Popover$1 = Popover.Root;
8
- const PopoverTrigger = Popover.Trigger;
9
- function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
10
- return /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
11
- align,
12
- side: "bottom",
13
- sideOffset,
14
- className: "z-50",
15
- children: /* @__PURE__ */ jsx(Popover.Popup, {
16
- className: (s) => cn("z-50 origin-(--transform-origin) overflow-y-auto max-h-(--available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[closed]:animate-fd-popover-out data-[open]:animate-fd-popover-in", typeof className === "function" ? className(s) : className),
17
- ...props
18
- })
19
- }) });
20
- }
21
- Popover.Close;
22
- //#endregion
23
- export { Popover$1 as Popover, PopoverContent, PopoverTrigger };
@@ -1,11 +0,0 @@
1
- //#region ../shared-api/dist/utils/merge-refs.js
2
- function mergeRefs(...refs) {
3
- return (value) => {
4
- refs.forEach((ref) => {
5
- if (typeof ref === "function") ref(value);
6
- else if (ref != null) ref.current = value;
7
- });
8
- };
9
- }
10
- //#endregion
11
- export { mergeRefs };