@redocly/api-docs 0.2.0-next.6 → 0.2.0-next.8

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 (82) hide show
  1. package/lib/RedocStandalone.d.ts +2 -2
  2. package/lib/RedocStandalone.js +1 -1
  3. package/lib/RedoclyApiDocs.js +1 -1
  4. package/lib/RedoclyApiDocsStandalone.d.ts +2 -2
  5. package/lib/RedoclyApiDocsStandalone.js +3 -3
  6. package/lib/adapters/graphql/group/utils.js +1 -1
  7. package/lib/adapters/openapi/configure/resolve-request-values.js +1 -1
  8. package/lib/adapters/openapi/items/operation/content.js +1 -1
  9. package/lib/components/Header/HeaderItem.js +5 -5
  10. package/lib/components/Header/HeaderPageActions.d.ts +4 -0
  11. package/lib/components/Header/HeaderPageActions.js +1 -0
  12. package/lib/components/Header/PageActions.d.ts +4 -0
  13. package/lib/components/Header/PageActions.js +11 -0
  14. package/lib/components/ItemContent/hooks.js +1 -1
  15. package/lib/components/Mcp/McpPrompt.js +1 -1
  16. package/lib/components/Mcp/McpTool.js +1 -1
  17. package/lib/components/Mcp/utils.d.ts +1 -1
  18. package/lib/components/Mcp/utils.js +1 -1
  19. package/lib/components/Schema/views/DiscriminatorPropertyRow.js +1 -1
  20. package/lib/components/Schema/views/Examples.js +1 -1
  21. package/lib/components/Security/SecurityFlowDetail.js +1 -1
  22. package/lib/components/common/DeepLinkAnchor.js +9 -9
  23. package/lib/components/markdoc/SchemaDefinition.js +1 -1
  24. package/lib/components/panels/ExampleItem/ResponseExampleItem.js +1 -1
  25. package/lib/components/panels/LanguageItem/LanguagePanelItem.js +5 -1
  26. package/lib/components/panels/LanguageItem/styled.js +17 -14
  27. package/lib/components/panels/McpExamplePanelItem.js +2 -2
  28. package/lib/components/panels/styled.js +1 -1
  29. package/lib/components/pluggable/RedocResponseSamples.js +1 -1
  30. package/lib/hoc/withLicenseGate.d.ts +5 -0
  31. package/lib/hoc/withLicenseGate.js +1 -0
  32. package/lib/hoc/withStoreProvider.d.ts +2 -0
  33. package/lib/hoc/withStoreProvider.js +1 -1
  34. package/lib/hooks/useCopySpecSlice.d.ts +9 -0
  35. package/lib/hooks/useCopySpecSlice.js +1 -0
  36. package/lib/hooks/useDeepLinkSection.js +1 -1
  37. package/lib/hooks/useLicense.js +1 -1
  38. package/lib/hooks/useLicenseGate.d.ts +6 -0
  39. package/lib/hooks/useLicenseGate.js +1 -0
  40. package/lib/hooks/useUrlHash.d.ts +3 -2
  41. package/lib/hooks/useUrlHash.js +1 -1
  42. package/lib/index.d.ts +3 -1
  43. package/lib/index.js +1 -1
  44. package/lib/jotai/store.d.ts +4 -0
  45. package/lib/jotai/store.js +1 -1
  46. package/lib/options/helpers.d.ts +0 -1
  47. package/lib/options/helpers.js +1 -1
  48. package/lib/options/normalizeOptions.js +1 -1
  49. package/lib/options/standaloneLayoutVars.d.ts +3 -0
  50. package/lib/options/standaloneLayoutVars.js +1 -0
  51. package/lib/services/code-samples/replay/from-openapi-document.d.ts +8 -1
  52. package/lib/services/code-samples/replay/from-openapi-document.js +1 -1
  53. package/lib/services/code-samples/replay/index.d.ts +1 -1
  54. package/lib/services/code-samples/replay/index.js +1 -1
  55. package/lib/services/license/check.d.ts +1 -0
  56. package/lib/services/license/check.js +1 -1
  57. package/lib/services/search/indexer.js +1 -1
  58. package/lib/services/spec-slice/assistant-links.d.ts +9 -0
  59. package/lib/services/spec-slice/assistant-links.js +5 -0
  60. package/lib/services/spec-slice/asyncapi-slice.d.ts +5 -0
  61. package/lib/services/spec-slice/asyncapi-slice.js +1 -0
  62. package/lib/services/spec-slice/clone-strip.d.ts +1 -0
  63. package/lib/services/spec-slice/clone-strip.js +1 -0
  64. package/lib/services/spec-slice/component-closure.d.ts +6 -0
  65. package/lib/services/spec-slice/component-closure.js +1 -0
  66. package/lib/services/spec-slice/graphql-slice.d.ts +2 -0
  67. package/lib/services/spec-slice/graphql-slice.js +1 -0
  68. package/lib/services/spec-slice/index.d.ts +6 -0
  69. package/lib/services/spec-slice/index.js +1 -0
  70. package/lib/services/spec-slice/openapi-slice.d.ts +6 -0
  71. package/lib/services/spec-slice/openapi-slice.js +1 -0
  72. package/lib/services/spec-slice/resolve-scope.d.ts +4 -0
  73. package/lib/services/spec-slice/resolve-scope.js +1 -0
  74. package/lib/services/spec-slice/types.d.ts +37 -0
  75. package/lib/services/spec-slice/types.js +0 -0
  76. package/lib/standalone.js +2 -2
  77. package/lib/types/content.d.ts +2 -2
  78. package/lib/types/options.d.ts +0 -6
  79. package/lib/utils/compose.d.ts +1 -0
  80. package/lib/utils/x-logo.d.ts +1 -1
  81. package/lib/utils/x-logo.js +1 -1
  82. package/package.json +11 -12
@@ -0,0 +1 @@
1
+ import{Kind as t,OperationTypeNode as O,parse as g,print as F,visit as Y}from"graphql";const C=new Set([t.SCALAR_TYPE_DEFINITION,t.OBJECT_TYPE_DEFINITION,t.INTERFACE_TYPE_DEFINITION,t.UNION_TYPE_DEFINITION,t.ENUM_TYPE_DEFINITION,t.INPUT_OBJECT_TYPE_DEFINITION]),A=new Set([t.SCALAR_TYPE_EXTENSION,t.OBJECT_TYPE_EXTENSION,t.INTERFACE_TYPE_EXTENSION,t.UNION_TYPE_EXTENSION,t.ENUM_TYPE_EXTENSION,t.INPUT_OBJECT_TYPE_EXTENSION]);function S(o){return C.has(o.kind)}function v(o){return A.has(o.kind)}const P={query:O.QUERY,mutation:O.MUTATION,subscription:O.SUBSCRIPTION},M=["query","mutation","subscription"],k={query:"Query",mutation:"Mutation",subscription:"Subscription"};function R(o){const i={typeDefs:new Map,typeExts:new Map,directiveDefs:new Map,schemaExts:[]};for(const n of o.definitions)if(S(n))i.typeDefs.set(n.name.value,n);else if(v(n)){const r=n.name.value,s=i.typeExts.get(r)??[];s.push(n),i.typeExts.set(r,s)}else n.kind===t.DIRECTIVE_DEFINITION?i.directiveDefs.set(n.name.value,n):n.kind===t.SCHEMA_DEFINITION?i.schemaDef=n:n.kind===t.SCHEMA_EXTENSION&&i.schemaExts.push(n);return i}function x(o){const i={typeNames:[],directiveNames:[],operationFields:new Map},n=r=>{if(r.kind==="graphql-type")i.typeNames.push(r.name);else if(r.kind==="graphql-directive")i.directiveNames.push(r.name);else{const s=i.operationFields.get(r.operationType)??[];s.push(r.name),i.operationFields.set(r.operationType,s)}};if(o.kind==="graphql-type"||o.kind==="graphql-directive"||o.kind==="graphql-operation")return n(o),i;if(o.kind==="graphql-group")return o.members.forEach(n),i}function w(o,i){const n=P[i];for(const r of[o.schemaDef,...o.schemaExts])for(const s of r?.operationTypes??[])if(s.operation===n)return s.type.name.value;return k[i]}function q(o,i,n){const r=[],s=new Set,c=[i,...o.typeExts.get(i.name.value)??[]];for(const d of c)if(!(d.kind!==t.OBJECT_TYPE_DEFINITION&&d.kind!==t.OBJECT_TYPE_EXTENSION))for(const T of d.fields??[]){const a=T.name.value;n.has(a)&&!s.has(a)&&(s.add(a),r.push(T))}return r}function B(o,i){const n=x(i);if(!n)return;let r;try{r=g(o,{noLocation:!0})}catch{return}const s=R(r),c=new Map,d=[];let T=!1;for(const e of M){const f=n.operationFields.get(e);if(!f?.length)continue;const E=w(s,e),I=s.typeDefs.get(E);if(I?.kind!==t.OBJECT_TYPE_DEFINITION)continue;const _=q(s,I,new Set(f));if(!_.length)continue;const y=c.get(E);c.set(E,{kind:t.OBJECT_TYPE_DEFINITION,name:I.name,description:I.description,directives:I.directives,fields:y?[...y.fields??[],..._]:_}),d.push({kind:t.OPERATION_TYPE_DEFINITION,operation:P[e],type:{kind:t.NAMED_TYPE,name:{kind:t.NAME,value:E}}}),E!==k[e]&&(T=!0)}const a=d.length&&(s.schemaDef||T)?{kind:t.SCHEMA_DEFINITION,description:s.schemaDef?.description,directives:s.schemaDef?.directives,operationTypes:d}:void 0,p=new Set,l=new Set,N=[],h=e=>{if(p.has(e))return;const f=s.typeDefs.get(e);if(!f)return;p.add(e);const E=c.get(e);if(E){N.push(E);return}N.push(f,...s.typeExts.get(e)??[])},D=e=>{if(l.has(e))return;const f=s.directiveDefs.get(e);f&&(l.add(e),N.push(f))};a&&N.push(a);for(const e of c.keys())h(e);for(const e of n.typeNames)h(e);for(const e of n.directiveNames)D(e);if(p.size===0&&l.size===0)return;for(;N.length;){const e=N.pop();e&&Y(e,{NamedType(f){h(f.name.value)},Directive(f){D(f.name.value)}})}const u=[];let m=!1;for(const e of r.definitions)if(e.kind===t.SCHEMA_DEFINITION)a&&(u.push(a),m=!0);else if(S(e)){const f=e.name.value;p.has(f)&&u.push(c.get(f)??e)}else if(v(e)){const f=e.name.value;p.has(f)&&!c.has(f)&&u.push(e)}else e.kind===t.DIRECTIVE_DEFINITION&&l.has(e.name.value)&&u.push(e);if(a&&!m&&u.unshift(a),u.length!==0)return F({kind:t.DOCUMENT,definitions:u})}export{B as extractGraphqlSlice};
@@ -0,0 +1,6 @@
1
+ import type { ApiSpecType } from '../../types/common.js';
2
+ import type { SpecSliceScope } from './types.js';
3
+ export { resolveSpecSliceScope } from './resolve-scope.js';
4
+ export { ASSISTANT_LINK_BASES, buildInlinePromptLink, buildFetchSpecPromptLink, } from './assistant-links.js';
5
+ export type { SliceContentKind, SpecSliceScope } from './types.js';
6
+ export declare function buildSpecSlice(specType: ApiSpecType, document: unknown, scope: SpecSliceScope): Promise<string | undefined>;
@@ -0,0 +1 @@
1
+ import{dump as n}from"js-yaml";import{isRecord as f}from"../../adapters/helpers.js";import{apiSpecType as t}from"../../types/common.js";import{extractOpenApiSlice as c}from"./openapi-slice.js";import{extractAsyncApiSlice as p}from"./asyncapi-slice.js";import{resolveSpecSliceScope as x}from"./resolve-scope.js";import{ASSISTANT_LINK_BASES as h,buildInlinePromptLink as I,buildFetchSpecPromptLink as y}from"./assistant-links.js";async function s(o,e,i){switch(o){case t.GRAPHQL:{if(typeof e!="string")return;if(i.kind==="document")return e;const{extractGraphqlSlice:r}=await import("./graphql-slice.js");return r(e,i)}case t.OPENAPI:{if(f(e)){const r=c(e,i);if(r)return n(r.document,{noRefs:!0,lineWidth:-1})}return}case t.ASYNCAPI:{if(f(e)){const r=p(e,i);if(r)return n(r.document,{noRefs:!0,lineWidth:-1})}return}default:return}}export{h as ASSISTANT_LINK_BASES,y as buildFetchSpecPromptLink,I as buildInlinePromptLink,s as buildSpecSlice,x as resolveSpecSliceScope};
@@ -0,0 +1,6 @@
1
+ import type { SpecSliceScope } from './types.js';
2
+ export declare function parsePointerTokens(pointer: string): string[];
3
+ export declare function operationScopeFromPointer(pointer: string, isWebhook: boolean | undefined): SpecSliceScope | undefined;
4
+ export declare function extractOpenApiSlice(document: Record<string, unknown>, scope: SpecSliceScope): {
5
+ document: Record<string, unknown>;
6
+ } | undefined;
@@ -0,0 +1 @@
1
+ import{isRecord as f}from"../../adapters/helpers.js";import{resolvePathItemRef as A}from"../../adapters/openapi/utils/resolvePathItemRef.js";import{JsonPointer as O}from"../../adapters/openapi/utils/JsonPointer.js";import{isOperationName as v}from"../../utils/http-methods.js";import{encodeJsonPointerSegment as w}from"../../utils/refPointer.js";import{DEFAULT_WEBHOOKS_TAG_NAME as x}from"../../constants/openapi.js";import{collectComponentClosure as S,buildComponentsFromClosure as T}from"./component-closure.js";import{cloneStrip as g}from"./clone-strip.js";const N=["openapi","info","jsonSchemaDialect","externalDocs","servers","security"];function I(e){const n=e.startsWith("/")||e.startsWith("#")?e:`/${e}`;try{return O.parse(n)}catch{return[]}}function L(e,n){const r=I(e);if(!(r.length<3||r[0]!=="paths"))return{kind:"operation",pathName:r[1],httpVerb:r[2],source:n?"webhooks":"paths"}}function W(e,n){if(typeof e.openapi!="string")return;if(n.kind==="document")return{document:g(e,new Map)};const r=M(e,n);if(!r)return;const{draft:s,extraSeeds:o=[]}=r,i=S(e,[s,...o]),t=T(e,i.keep);return t&&(s.components=t),{document:g(s,i.inlineTargets)}}function M(e,n){const r={};for(const p of N)e[p]!==void 0&&(r[p]=e[p]);if(n.kind==="schema"){const p=f(e.components)?e.components.schemas:void 0;if(!f(p)||!(n.name in p))return;r.paths={};const d={$ref:`#/components/schemas/${w(n.name)}`};return{draft:r,extraSeeds:[d]}}const s=e["x-webhooks"]?"x-webhooks":"webhooks",o=e["x-webhooks"]??e.webhooks;let i,t;if(n.kind==="operation"){i=new Map,t=new Map;const p=n.source==="webhooks"?o:e.paths,d=P(e,p,n.pathName,n.httpVerb);if(!d)return;(n.source==="webhooks"?t:i).set(n.pathName,d)}else if(n.kind==="tag"){if(i=k(e,e.paths,n.tagName,!1),t=k(e,o,n.tagName,!0),i.size===0&&t.size===0)return}else return;const a=new Set;for(const p of[...i.values(),...t.values()])for(const{operation:d}of p.operations){const l=d.tags;if(Array.isArray(l))for(const h of l)typeof h=="string"&&a.add(h)}const c=K(e,a);c.length&&(r.tags=c);const u=_(e,a);return u.length&&(r["x-tagGroups"]=u),r.paths=b(i),t.size&&(r[s]=b(t)),{draft:r}}function m(e,n){if(f(n))try{const r=A(e,n,e.openapi);return f(r)?r:void 0}catch{return}}function P(e,n,r,s){if(!f(n))return;const o=m(e,n[r]);if(!o)return;const i=o[s];if(f(i))return{pathItem:o,operations:[{operation:i,verbKey:s,isAdditional:!1}]};if(s==="query"&&f(o["x-query"]))return{pathItem:o,operations:[{operation:o["x-query"],verbKey:"x-query",isAdditional:!1}]};const t=f(o.additionalOperations)?o.additionalOperations[s]:void 0;if(f(t))return{pathItem:o,operations:[{operation:t,verbKey:s,isAdditional:!0}]}}function y(e,n,r){return(Array.isArray(e.tags)?e.tags:[r?x:""]).includes(n)}function k(e,n,r,s){const o=new Map;if(!f(n))return o;for(const i of Object.keys(n)){const t=m(e,n[i]);if(!t)continue;const a=[];for(const[c,u]of Object.entries(t))!v(c)||!f(u)||y(u,r,s)&&a.push({operation:u,verbKey:c,isAdditional:!1});if(f(t.additionalOperations))for(const[c,u]of Object.entries(t.additionalOperations))f(u)&&y(u,r,s)&&a.push({operation:u,verbKey:c,isAdditional:!0});a.length&&o.set(i,{pathItem:t,operations:a})}return o}const E=["summary","description","parameters","servers"];function b(e){const n={};for(const[r,{pathItem:s,operations:o}]of e){const i={};for(const a of E)s[a]!==void 0&&(i[a]=s[a]);const t={};for(const{operation:a,verbKey:c,isAdditional:u}of o)u?t[c]=a:i[c]=a;Object.keys(t).length&&(i.additionalOperations=t),n[r]=i}return n}function K(e,n){const r=Array.isArray(e.tags)?e.tags:[],s=new Map;for(const t of r)f(t)&&typeof t.name=="string"&&s.set(t.name,t);const o=new Set,i=t=>{if(o.has(t))return;const a=s.get(t);a&&(o.add(t),typeof a.parent=="string"&&i(a.parent))};for(const t of n)i(t);return r.filter(t=>f(t)&&o.has(t.name))}function _(e,n){const r=e["x-tagGroups"];if(!Array.isArray(r))return[];const s=[];for(const o of r){if(!f(o)||!Array.isArray(o.tags))continue;const i=o.tags.filter(t=>typeof t=="string"&&n.has(t));i.length&&s.push({...o,tags:i})}return s}export{W as extractOpenApiSlice,L as operationScopeFromPointer,I as parsePointerTokens};
@@ -0,0 +1,4 @@
1
+ import type { ApiItemContent } from '../../types/store.js';
2
+ import type { ApiSpecType } from '../../types/common.js';
3
+ import type { SpecSliceScope } from './types.js';
4
+ export declare function resolveSpecSliceScope(specType: ApiSpecType, content: ApiItemContent | null | undefined, label: string | undefined, groupMemberContents?: Array<ApiItemContent | null | undefined>): SpecSliceScope | undefined;
@@ -0,0 +1 @@
1
+ import{apiSpecType as u,contentType as t,itemVariant as i}from"../../types/common.js";import{BUILT_IN_DIRECTIVES as m,BUILT_IN_SCALARS as s}from"../../adapters/graphql/utils/constants.js";import{operationScopeFromPointer as T}from"./openapi-slice.js";import{scopeFromAsyncApiPointer as A}from"./asyncapi-slice.js";function V(e,r,n,p){if(r){if(r.contentType===t.OVERVIEW)return{kind:"document"};switch(e){case u.OPENAPI:return I(r);case u.ASYNCAPI:return S(r,n);case u.GRAPHQL:return r.contentType===t.GROUP?N(n,p):d(r);default:return}}}function I(e){if(e.contentType===t.GROUP){const r=e.meta?.name;return typeof r=="string"?{kind:"tag",tagName:r}:void 0}if(e.contentType===t.ITEM){if(e.itemVariant===i.HTTP_ITEM&&e.meta?.pointer)return T(e.meta.pointer,e.meta.isWebhook);if(e.itemVariant===i.SCHEMA&&e.meta?.name)return{kind:"schema",name:e.meta.name}}}const E={[i.QUERY]:"query",[i.MUTATION]:"mutation",[i.SUBSCRIPTION]:"subscription"},c=new Set([i.OBJECT,i.INTERFACE,i.INPUT,i.UNION,i.ENUM,i.SCALAR]);function d(e){if(e.contentType!==t.ITEM||!e.itemVariant)return;const r=e.meta?.name;if(typeof r!="string"||!r)return;const n=E[e.itemVariant];if(n)return{kind:"graphql-operation",operationType:n,name:r};if(c.has(e.itemVariant))return s.has(r)?void 0:{kind:"graphql-type",name:r};if(e.itemVariant===i.DIRECTIVE)return m.has(r)?void 0:{kind:"graphql-directive",name:r}}function N(e,r){if(!r?.length)return;const n=[],p=new Set;for(const o of r){const a=o?d(o):void 0;if(!a)continue;const f=`${a.kind}/${"operationType"in a?a.operationType:""}/${a.name}`;p.has(f)||(p.add(f),n.push(a))}return n.length?{kind:"graphql-group",label:e,members:n}:void 0}function S(e,r){if(e.contentType===t.GROUP)return r?{kind:"tag",tagName:r}:void 0;if(e.contentType===t.ITEM&&(e.itemVariant===i.CHANNEL||e.itemVariant===i.CHANNEL_OPERATION)&&e.meta?.pointer)return A(e.meta.pointer)}export{V as resolveSpecSliceScope};
@@ -0,0 +1,37 @@
1
+ export type GraphqlOperationType = 'query' | 'mutation' | 'subscription';
2
+ export type GraphqlItemScope = {
3
+ kind: 'graphql-operation';
4
+ operationType: GraphqlOperationType;
5
+ name: string;
6
+ } | {
7
+ kind: 'graphql-type';
8
+ name: string;
9
+ } | {
10
+ kind: 'graphql-directive';
11
+ name: string;
12
+ };
13
+ export type SpecSliceScope = {
14
+ kind: 'document';
15
+ } | {
16
+ kind: 'tag';
17
+ tagName: string;
18
+ } | {
19
+ kind: 'operation';
20
+ pathName: string;
21
+ httpVerb: string;
22
+ source: 'paths' | 'webhooks';
23
+ } | {
24
+ kind: 'schema';
25
+ name: string;
26
+ } | {
27
+ kind: 'channel';
28
+ channelId: string;
29
+ } | {
30
+ kind: 'async-operation';
31
+ operationId: string;
32
+ } | GraphqlItemScope | {
33
+ kind: 'graphql-group';
34
+ label?: string;
35
+ members: GraphqlItemScope[];
36
+ };
37
+ export type SliceContentKind = 'yaml' | 'graphql';
File without changes
package/lib/standalone.js CHANGED
@@ -1,2 +1,2 @@
1
- import{createElement as m}from"react";import{createRoot as g,hydrateRoot as E}from"react-dom/client";import{HashRouter as R}from"react-router";import{RedocStandalone as y,prepareApiDocs as S}from"./RedocStandalone.js";import{RedoclyApiDocsStandalone as A}from"./RedoclyApiDocsStandalone.js";import{logoFromDefinition as T}from"./utils/x-logo.js";const C=["html","cli","react","docker"];function M(e,t){return C.includes(e)?e:t}function f(e){return typeof document<"u"?document.querySelector(e):null}function w(e){const t={};for(const o of Array.from(e.attributes))t[o.name]=o.value;return t}function q(e){const t=w(e),o={};for(const r in t){const s=r.replace(/-(.)/g,(n,c)=>c.toUpperCase());o[s]=t[r]}return o}function h(e,t,o,r){const{router:s,disableTelemetry:n,specType:c,typeOfUsage:i,basePath:p,...u}={...t,...q(o)};let l,a;return typeof e=="string"?c==="graphql"&&!I(e)?a=e:l=e:typeof e=="object"&&(a=e),{router:s,props:{definition:a,definitionUrl:l,specType:c,options:u,basePath:p,telemetryConfig:{typeOfUsage:M(i,r),...n!==void 0?{disabled:n===!0||String(n)==="true"}:{}}}}}function d(e,t){return t==="history"?e:m(R,null,e)}function b(e){if(e===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');return e}function v(e,t={},o=f("redoc")){const r=b(o),{router:s,props:n}=h(e,t,r,"html");g(r).render(d(m(y,n),s))}const H=/server rendered HTML didn't match the client|error while hydrating|Minified React error #(418|423)/;async function L(e,t={},o=f("redoc")){const r=b(o),{router:s,props:n}=h(e,t,r,"cli"),c=n.basePath??"/",i=await S({...n,basePath:c}),p=m(A,{items:i.items,store:i.store,basePath:c,options:i.options,logo:T(i.document),telemetryConfig:n.telemetryConfig,definition:i.document});if(r.childElementCount===0){g(r).render(d(p,s));return}E(r,d(p,s),{onRecoverableError:(u,l)=>{const a=u instanceof Error?u.message:String(u);H.test(a)||console.error(a,l)}})}function I(e){return!e.includes(`
2
- `)&&/^[^\s]+$/.test(e)}function P(){const e=f("redoc");if(!e)return;const t=e.getAttribute("spec-url");t&&v(t,{},e)}P();export{y as RedocStandalone,L as hydrate,v as init};
1
+ import{createElement as f}from"react";import{createRoot as g,hydrateRoot as E}from"react-dom/client";import{HashRouter as R}from"react-router";import{RedocStandalone as y,prepareApiDocs as S}from"./RedocStandalone.js";import{RedoclyApiDocsStandalone as A}from"./RedoclyApiDocsStandalone.js";import{logoFromDefinition as T}from"./utils/x-logo.js";const C=["html","cli","react","docker"];function M(e,t){return C.includes(e)?e:t}function m(e){return typeof document<"u"?document.querySelector(e):null}function w(e){const t={};for(const o of Array.from(e.attributes))t[o.name]=o.value;return t}function U(e){const t=w(e),o={};for(const r in t){const s=r.replace(/-(.)/g,(n,c)=>c.toUpperCase());o[s]=t[r]}return o}function h(e,t,o,r){const{router:s,disableTelemetry:n,specType:c,typeOfUsage:i,basePath:p,...u}={...t,...U(o)};let l,a;return typeof e=="string"?c==="graphql"&&!H(e)?a=e:l=e:typeof e=="object"&&(a=e),{router:s,props:{definition:a,definitionUrl:l,specType:c,options:u,basePath:p,telemetryConfig:{typeOfUsage:M(i,r),...n!==void 0?{disabled:n===!0||String(n)==="true"}:{}}}}}function d(e,t){return t==="history"?e:f(R,null,e)}function b(e){if(e===null)throw new Error('"element" argument is not provided and <redoc> tag is not found on the page');return e}function q(e,t={},o=m("redoc")){const r=b(o),{router:s,props:n}=h(e,t,r,"html");g(r).render(d(f(y,n),s))}const v=/server rendered HTML didn't match the client|error while hydrating|Minified React error #(418|423)/;async function L(e,t={},o=m("redoc")){const r=b(o),{router:s,props:n}=h(e,t,r,"cli"),c=n.basePath??"/",i=await S({...n,basePath:c}),p=f(A,{items:i.items,store:i.store,basePath:c,options:i.options,logo:T(i.document),telemetryConfig:n.telemetryConfig,definition:i.document,definitionUrl:n.definitionUrl});if(r.childElementCount===0){g(r).render(d(p,s));return}E(r,d(p,s),{onRecoverableError:(u,l)=>{const a=u instanceof Error?u.message:String(u);v.test(a)||console.error(a,l)}})}function H(e){return!e.includes(`
2
+ `)&&/^[^\s]+$/.test(e)}function I(){const e=m("redoc");if(!e)return;const t=e.getAttribute("spec-url");t&&q(t,{},e)}I();export{y as RedocStandalone,L as hydrate,q as init};
@@ -406,7 +406,7 @@ export type ResponseExamplesPanelItem = BaseExamplePanelItem & {
406
406
  kind: typeof panelKind.RESPONSE;
407
407
  exampleIds?: string[];
408
408
  responseCodes?: ResponseCodeEntry[];
409
- headerTitle?: string;
409
+ hideHeaderTitle?: boolean;
410
410
  exampleKey?: string;
411
411
  };
412
412
  export type GraphQLQueryPanelItem = BaseExamplePanelItem & {
@@ -469,7 +469,7 @@ export type OverviewPanelItem = ExternalLinkPanelItem | EmailPanelItem | KeyValu
469
469
  export type McpPanelItem = KeyValuePanelItem | TagsPanelItem | ExternalLinkPanelItem | ConnectMcpButtonPanelItem;
470
470
  export type McpExamplePanelItem = {
471
471
  kind: typeof panelKind.MCP_EXAMPLE;
472
- headerTitle: string;
472
+ headerTitleTranslationKey: string;
473
473
  data: unknown;
474
474
  language?: string;
475
475
  };
@@ -93,8 +93,6 @@ export type ApiDocsOptions = {
93
93
  scrollYOffset: () => number;
94
94
  hideLoading: boolean;
95
95
  skipBundle: boolean;
96
- hideSidebar: boolean;
97
- hideSearch: boolean;
98
96
  basePath: string;
99
97
  specType: ApiSpecType;
100
98
  metadata: ApiDocsMetadata;
@@ -104,7 +102,6 @@ export type ApiDocsOptions = {
104
102
  jsonSamplesDepth: number;
105
103
  samplesMaxInlineArgs: number;
106
104
  fieldExpandLevel: number;
107
- baseUrlPath?: string;
108
105
  } & GraphQLOptions;
109
106
  export type RawApiDocsOptions = EditionRedocConfig & EditionAsyncApiConfig & EditionGraphQLConfig & {
110
107
  specType: ApiSpecType;
@@ -114,9 +111,6 @@ export type RawApiDocsOptions = EditionRedocConfig & EditionAsyncApiConfig & Edi
114
111
  requiredPropsFirst?: boolean;
115
112
  licenseKey?: string;
116
113
  protocol?: ProtocolVariant;
117
- excludeFromSearch?: boolean;
118
- /** Hides the standalone sidebar search. Portal embeds have their own search. */
119
- hideSearch?: boolean;
120
114
  dynamicRequestValues?: ConfigureRequestValues | ConfigureServerRequestValues;
121
115
  userClaims?: UserClaims;
122
116
  layout?: EditionRedocConfig['layout'] | EditionAsyncApiConfig['layout'] | EditionGraphQLConfig['layout'];
@@ -4,4 +4,5 @@ export declare function compose<P>(f: HOC<P>): (Component: ComponentType<P>) =>
4
4
  export declare function compose<P>(f: HOC<P>, g: HOC<P>): (Component: ComponentType<P>) => FC<P>;
5
5
  export declare function compose<P>(f: HOC<P>, g: HOC<P>, h: HOC<P>): (Component: ComponentType<P>) => FC<P>;
6
6
  export declare function compose<P>(f: HOC<P>, g: HOC<P>, h: HOC<P>, i: HOC<P>): (Component: ComponentType<P>) => FC<P>;
7
+ export declare function compose<P>(f: HOC<P>, g: HOC<P>, h: HOC<P>, i: HOC<P>, j: HOC<P>): (Component: ComponentType<P>) => FC<P>;
7
8
  export {};
@@ -9,5 +9,5 @@ export type LogoConfig = XLogo;
9
9
  * Derives the sidebar logo config from the definition's `info['x-logo']`
10
10
  * extension, falling back to `info.contact.url` for the link.
11
11
  */
12
- export declare function logoFromDefinition(definition: Record<string, unknown> | undefined): LogoConfig | undefined;
12
+ export declare function logoFromDefinition(definition: Record<string, unknown> | string | undefined): LogoConfig | undefined;
13
13
  export {};
@@ -1 +1 @@
1
- function c(r){const n=r?.info,o=n?.["x-logo"];if(!o?.url)return;const t=n?.contact;return{url:o.url,href:o.href||t?.url,altText:o.altText,backgroundColor:o.backgroundColor}}export{c as logoFromDefinition};
1
+ function e(n){if(typeof n=="string")return;const r=n?.info,o=r?.["x-logo"];if(!o?.url)return;const t=r?.contact;return{url:o.url,href:o.href||t?.url,altText:o.altText,backgroundColor:o.backgroundColor}}export{e as logoFromDefinition};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/api-docs",
3
- "version": "0.2.0-next.6",
3
+ "version": "0.2.0-next.8",
4
4
  "description": "Redocly API Documentation Library",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -31,7 +31,12 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@markdoc/markdoc": "0.5.2",
34
+ "@redocly/allof-merge": "0.6.9",
35
+ "@redocly/config": "0.55.0",
34
36
  "@redocly/openapi-core": "2.47.0",
37
+ "@redocly/redoc-opentelemetry": "0.2.4",
38
+ "@redocly/replay": "0.28.0-next.7",
39
+ "@redocly/theme": "^0.69.0-next.7",
35
40
  "dompurify": "3.4.13",
36
41
  "fast-xml-parser": "5.7.3",
37
42
  "graphql": "16.14.2",
@@ -47,12 +52,7 @@
47
52
  "slugify": "^1.4.7",
48
53
  "swagger2openapi": "^7.0.8",
49
54
  "url-template": "^2.0.8",
50
- "web-vitals": "3.3.1",
51
- "@redocly/allof-merge": "0.6.9",
52
- "@redocly/config": "0.54.0",
53
- "@redocly/redoc-opentelemetry": "0.2.4",
54
- "@redocly/replay": "0.28.0-next.6",
55
- "@redocly/theme": "^0.69.0-next.6"
55
+ "web-vitals": "3.3.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@microsoft/api-extractor": "7.58.2",
@@ -68,8 +68,8 @@
68
68
  "@types/react-dom": "^19.2.3",
69
69
  "@types/swagger2openapi": "^7.0.4",
70
70
  "@vitejs/plugin-react": "6.0.1",
71
- "@vitest/browser-playwright": "4.1.10",
72
- "@vitest/coverage-v8": "4.1.10",
71
+ "@vitest/browser-playwright": "4.1.11",
72
+ "@vitest/coverage-v8": "4.1.11",
73
73
  "esbuild": "0.28.1",
74
74
  "flexsearch": "^0.8.2",
75
75
  "globals": "^16.5.0",
@@ -82,8 +82,8 @@
82
82
  "tsx": "^4.20.6",
83
83
  "typescript": "6.0.3",
84
84
  "url": "~0.11.0",
85
- "vite": "8.1.0",
86
- "vitest": "4.1.10",
85
+ "vite": "8.2.2",
86
+ "vitest": "4.1.11",
87
87
  "vitest-browser-react": "^2.0.2"
88
88
  },
89
89
  "nx": {
@@ -113,7 +113,6 @@
113
113
  "test": "nx run vitest:test",
114
114
  "test:update": "nx run vitest:test -u --skip-nx-cache",
115
115
  "test:coverage:html": "nx run vitest:test --coverage --coverage.reporter=html --exclude 'tools/**'",
116
- "test:tools": "vitest run tools",
117
116
  "test:ce": "pnpm run stage:ce && cd redoc && npm run unit",
118
117
  "ts:check": "tsgo -p tsconfig.build.json --noEmit --skipLibCheck"
119
118
  }