fumadocs-openapi 10.0.0 → 10.0.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../src/playground/components/inputs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAkDxD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EAAE,MAAM,EACb,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IACD,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAAC,KAAK,CAAC,uDAwCxB;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,2CA8B7D;AA6FD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,UAAU,EACV,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,uDAoGA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EAAE,MAAM,EACb,SAAS,EACT,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAS,EACT,QAAQ,EACR,WAAkB,EAClB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,SA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AC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,kDA4KA"}
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useMemo, useState, } from 'react';
4
4
  import { ChevronDown, Plus, Trash2, X } from '../../icons.js';
5
- import { set, useController, useFieldArray, useFormContext, } from 'react-hook-form';
5
+ import { useController, useFieldArray, useFormContext } from 'react-hook-form';
6
6
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../../ui/components/select.js';
7
7
  import { Input, labelVariants } from '../../ui/components/input.js';
8
8
  import { getDefaultValue } from '../get-default-values.js';
@@ -109,17 +109,11 @@ export function FieldInput({ field, fieldName, isRequired, ...props }) {
109
109
  }, hidden: true, ...restField })] }));
110
110
  }
111
111
  if (field.type === 'boolean') {
112
- return (_jsxs(Select, { value: String(value), onValueChange: (value) => onChange(value === 'null' ? null : value === 'true'), disabled: restField.disabled, children: [_jsx(SelectTrigger, { id: fieldName, className: props.className, ...restField, children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "true", children: "True" }), _jsx(SelectItem, { value: "false", children: "False" }), !isRequired && _jsx(SelectItem, { value: "null", children: "Null" })] })] }));
112
+ return (_jsxs(Select, { value: String(value), onValueChange: (value) => onChange(value === 'undefined' ? undefined : value === 'true'), disabled: restField.disabled, children: [_jsx(SelectTrigger, { id: fieldName, className: props.className, ...restField, children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "true", children: "True" }), _jsx(SelectItem, { value: "false", children: "False" }), !isRequired && _jsx(SelectItem, { value: "undefined", children: "Unset" })] })] }));
113
113
  }
114
114
  if (field.type === 'null')
115
115
  return;
116
- return (_jsxs("div", { ...props, className: cn('flex flex-row gap-2', props.className), children: [_jsx(Input, { id: fieldName, placeholder: "Enter value", type: field.type === 'string' ? 'text' : 'number', step: field.type === 'number' ? 'any' : undefined, value: value ?? '', onChange: onChange, ...restField }), !isRequired && value !== undefined && (_jsx("button", { type: "button", onClick: () => {
117
- // TODO: react-hook-form `reset()` cannot clear default values
118
- form.reset((values) => {
119
- set(values, fieldName, undefined);
120
- return values;
121
- });
122
- }, className: "text-fd-muted-foreground", children: _jsx(X, { className: "size-4" }) }))] }));
116
+ return (_jsxs("div", { ...props, className: cn('flex flex-row gap-2', props.className), children: [_jsx(Input, { id: fieldName, placeholder: "Enter value", type: field.type === 'number' ? 'number' : 'text', step: field.type === 'number' ? 'any' : undefined, value: value ?? '', onChange: (e) => onChange(field.type === 'number' ? e.target.valueAsNumber : e.target.value), ...restField }), !isRequired && value !== undefined && (_jsx("button", { type: "button", onClick: () => onChange(undefined), className: "text-fd-muted-foreground", children: _jsx(X, { className: "size-4" }) }))] }));
123
117
  }
124
118
  export function FieldSet({ field: _field, fieldName, toolbar, name, isRequired, depth = 0, slotType, collapsible = true, ...props }) {
125
119
  const field = useResolvedSchema(_field);
@@ -1,3 +1,4 @@
1
+ import '@scalar/api-client-react/style.css';
1
2
  export default function ScalarPlayground({ path, method, spec, }: {
2
3
  spec: object;
3
4
  path: string;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/scalar/client.tsx"],"names":[],"mappings":"AAYA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,IAAI,EACJ,MAAM,EACN,IAAI,GACL,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,2CA+BA"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/scalar/client.tsx"],"names":[],"mappings":"AAWA,OAAO,oCAAoC,CAAC;AAE5C,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,IAAI,EACJ,MAAM,EACN,IAAI,GACL,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,2CA6BA"}
@@ -6,6 +6,7 @@ import { ApiClientModalProvider, useApiClientModal, } from '@scalar/api-client-r
6
6
  import { MethodLabel } from '../ui/components/method-label.js';
7
7
  import { useTheme } from 'next-themes';
8
8
  import { useEffect, useState } from 'react';
9
+ import '@scalar/api-client-react/style.css';
9
10
  export default function ScalarPlayground({ path, method, spec, }) {
10
11
  const { resolvedTheme } = useTheme();
11
12
  const [mounted, setMounted] = useState(false);
@@ -14,9 +15,7 @@ export default function ScalarPlayground({ path, method, spec, }) {
14
15
  }, []);
15
16
  return (_jsxs("div", { className: cn('flex flex-row items-center gap-2.5 p-3 rounded-xl border bg-fd-card text-fd-card-foreground not-prose', mounted ? `${resolvedTheme}-mode` : null), children: [_jsx(MethodLabel, { className: "text-xs", children: method }), _jsx("code", { className: "flex-1 overflow-auto text-nowrap text-[13px] text-fd-muted-foreground", children: path }), _jsx(ApiClientModalProvider, { configuration: {
16
17
  theme: 'moon',
17
- spec: {
18
- content: spec,
19
- },
18
+ content: spec,
20
19
  }, children: _jsx(Trigger, { path: path, method: method }) })] }));
21
20
  }
22
21
  function Trigger({ path, method }) {
@@ -1,12 +1,8 @@
1
- import type { MethodInformation, RenderContext } from '../types.js';
2
1
  import type { CreateAPIPageOptions } from '../ui/index.js';
3
- export declare function APIPlayground({ path, method, ctx, }: {
4
- path: string;
5
- method: MethodInformation;
6
- ctx: RenderContext;
7
- }): import("react/jsx-runtime").JSX.Element;
8
2
  /**
9
3
  * Enable Scalar for API playgrounds by wrapping your options inside.
4
+ *
5
+ * Requires `@scalar/api-client-react` to be installed, it imports the styles automatically.
10
6
  */
11
7
  export declare function withScalar(options?: CreateAPIPageOptions): CreateAPIPageOptions;
12
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scalar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAKjD,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,GAAG,EAAE,aAAa,CAAC;CACpB,2CAIA;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,OAAO,GAAE,oBAAyB,GACjC,oBAAoB,CAUtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scalar/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAmBjD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,GAAE,oBAAyB,GACjC,oBAAoB,CAUtB"}
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { lazy } from 'react';
3
3
  const Client = lazy(() => import('./client.js'));
4
- export function APIPlayground({ path, method, ctx, }) {
4
+ function APIPlayground({ path, method, ctx, }) {
5
5
  return (_jsx(Client, { method: method.method, path: path, spec: ctx.schema.bundled }));
6
6
  }
7
7
  /**
8
8
  * Enable Scalar for API playgrounds by wrapping your options inside.
9
+ *
10
+ * Requires `@scalar/api-client-react` to be installed, it imports the styles automatically.
9
11
  */
10
12
  export function withScalar(options = {}) {
11
13
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "10.0.0",
3
+ "version": "10.0.2",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",