@redocly/api-docs 0.2.0-next.1 → 0.2.0-next.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.
- package/lib/adapters/openapi/build/context.js +1 -1
- package/lib/adapters/openapi/group/item.js +1 -1
- package/lib/adapters/openapi/items/schema/item.js +1 -1
- package/lib/adapters/utils/markdoc.js +1 -1
- package/lib/components/markdoc/html/html-jsx-attribute-mapping.d.ts +5 -0
- package/lib/components/markdoc/html/html-jsx-attribute-mapping.js +1 -0
- package/lib/components/markdoc/html/process-html-tokens.d.ts +1 -0
- package/lib/components/markdoc/html/process-html-tokens.js +1 -0
- package/lib/components/markdoc/markdocParser.d.ts +2 -0
- package/lib/components/markdoc/markdocParser.js +1 -1
- package/lib/components/panels/LanguageItem/styled.js +1 -1
- package/lib/services/code-samples/replay/overlay-converter.js +1 -1
- package/lib/types/openapi.d.ts +0 -1
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseMarkdown as M}from"../../utils/parseMarkdown.js";import{JsonPointer as B}from"../utils/JsonPointer.js";import{DEFAULT_WEBHOOKS_TAG_NAME as I}from"../../../constants/openapi.js";import{SUPPORTED_MCP_TYPES as N}from"../constants.js";import{titleize as S}from"../utils/helpers.js";import{resolveRef as b,readRbacScope as C,rbacProp as v}from"../../helpers.js";import{resolvePathItemRef as P}from"../utils/resolvePathItemRef.js";import{HTTP_METHODS as R,isOperationName as _}from"../../../utils/http-methods.js";import{REDOCLY_TEAMS_RBAC as A}from"@redocly/config";function
|
|
1
|
+
import{parseMarkdown as M}from"../../utils/parseMarkdown.js";import{JsonPointer as B}from"../utils/JsonPointer.js";import{DEFAULT_WEBHOOKS_TAG_NAME as I}from"../../../constants/openapi.js";import{SUPPORTED_MCP_TYPES as N}from"../constants.js";import{titleize as S}from"../utils/helpers.js";import{resolveRef as b,readRbacScope as C,rbacProp as v}from"../../helpers.js";import{resolvePathItemRef as P}from"../utils/resolvePathItemRef.js";import{HTTP_METHODS as R,isOperationName as _}from"../../../utils/http-methods.js";import{REDOCLY_TEAMS_RBAC as A}from"@redocly/config";function O(t){return t.kind==="badge"||t.kind==="audience"}function Z({document:t,options:e,basePath:a,storeCtx:c,processContent:p=!0}){const n=new Map;for(const r of t.tags||[]){const o=r;n.set(r.name,{tag:o,operations:[],description:r.description,children:[]})}for(const r of t.tags||[]){const o=r;o.parent&&!O(r)&&n.get(o.parent)?.children.push(r.name)}e?.schemaDefinitionsTagName&&q(n,e.schemaDefinitionsTagName);const i=(t.tags||[]).filter(O),s={document:t,options:e,basePath:a,tagsMap:n,collectedTagOrder:[],downloadUrls:e.downloadUrls,storeCtx:c,badgeTags:i,processContent:p};return L(t,s),$(t,s),s}function q(t,e){t.has(e)||t.set(e,{tag:{name:e},operations:[],children:[]})}function L(t,e){t.paths&&x(t.paths,!1,e);const a=t["x-webhooks"]||t.webhooks;a&&x(a,!0,e)}function $(t,e){const a=t["x-mcp"];if(a)for(const c of N){const p=a[c];if(p?.length)for(const n of p){const i=n.tags&&n.tags.length>0?n.tags:[S(c)];for(const s of i)e.tagsMap.has(s)||(e.tagsMap.set(s,{tag:{name:s},operations:[],children:[]}),e.collectedTagOrder.push(s))}}}function k(t,e){return{...e,summary:e.summary??t.summary,description:e.description??t.description,servers:e.servers??t.servers}}function x(t,e,a){const c=a.document,p=a.document.openapi;for(const[n,i]of Object.entries(t)){if(!i)continue;let s;try{s=P(c,i,p)}catch{console.warn(`[OpenAPI] Skipping path "${n}": failed to resolve path item $ref`);continue}if(!s)continue;const r=s.parameters??[];for(const f of Object.keys(s).filter(_)){const d=s[f];!d||typeof d!="object"||w(k(s,d),n,f,e,!1,a,r)}const o=s.additionalOperations;if(o)for(const[f,d]of Object.entries(o))w(k(s,d),n,f,e,!0,a,r)}}function j(t){return typeof t=="object"&&t!==null?t:{}}function H(t,e,a,c){if(!t.length&&!e?.length||!t.length)return e;if(!e?.length)return t;const p=new Set(e.map(i=>{const s=b(a,i,c)??i,r=j(s);return`${r.in}:${r.name}`})),n=[...e];for(const i of t){const s=b(a,i,c)??i,r=j(s),o=`${r.in}:${r.name}`;p.has(o)||n.push(i)}return n}function w(t,e,a,c,p,n,i=[]){const s=t.tags||(c?[I]:[""]),r=U(n.badgeTags,t,e,a,c,p,s,i,n);for(const o of s){let f=n.tagsMap.get(o);f||(f={tag:{name:o},operations:[],children:[]},n.tagsMap.set(o,f),n.collectedTagOrder.push(o)),!O(f.tag)&&(f.tag["x-traitTag"]||f.operations.push(r))}}function D(t){return t.toLowerCase()==="x-query"?"query":t}function U(t,e,a,c,p,n,i,s=[],r){const{options:o,storeCtx:f}=r,d=e.externalDocs,g=e["x-badges"]?.map(m=>({name:m.name,color:m.color,position:m.position}))??[];if(e.tags&&t.length>0)for(const m of e.tags){const l=t.find(u=>u.name===m);l&&g.push({name:l.summary??l.name,color:l.kind==="audience"?"grey":"blue",icon:l.kind==="audience"?"user-group":void 0,position:"after",description:typeof l.description=="string"?l.description:void 0})}return{...e,pointer:B.compile(["paths",a,c]),pathName:a,httpVerb:D(c),operationId:e.operationId,summary:e.summary,description:M(e.description,o),deprecated:e.deprecated,isWebhook:p,isAdditionalOperation:n,tags:i,parameters:H(s,e.parameters,f.document,o.ignoreNamedSchemas),requestBody:e.requestBody,responses:e.responses,servers:e.servers,security:e.security??r.document.security,callbacks:V(e.callbacks,f?.document??{},o.ignoreNamedSchemas),externalDocs:d?{url:d.url,description:d.description}:void 0,"x-seo":e?.["x-seo"],"x-badges":g.length>0?g:void 0}}function V(t,e,a){if(!t||typeof t!="object")return;const c=[];for(const[p,n]of Object.entries(t)){const i=b(e,n,a)??n;if(!i||typeof i!="object")continue;const s=C(i),r=i;for(const[o,f]of Object.entries(r)){if(o===A||!f||typeof f!="object")continue;const d=f.servers,T=f.parameters,g=[];for(const[m,l]of Object.entries(f)){if(!R.has(m.toLowerCase())||!l||typeof l!="object")continue;const u=l,h={httpVerb:D(m.toLowerCase()),pathName:o,summary:u.summary,operationId:u.operationId,description:u.description,deprecated:u.deprecated,requestBody:u.requestBody,responses:u.responses,security:u.security,servers:u.servers??d,parameters:u.parameters??T,externalDocs:u.externalDocs};for(const[y,E]of Object.entries(u))y.startsWith("x-")&&!(y in h)&&(h[y]=E);g.push(h)}g.length>0?c.push({name:p,url:o,operations:g,...v(s)}):c.push({name:p,url:o,...v(s)})}}return c.length>0?c:void 0}export{Z as createBuildContext,V as normalizeCallbacks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as f}from"@redocly/config";import{DEFAULT_WEBHOOKS_TAG_NAME as
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as f}from"@redocly/config";import{DEFAULT_WEBHOOKS_TAG_NAME as b,GROUP_DEPTH as _,MAX_NESTING_TAGS_LEVEL as w}from"../../../constants/openapi.js";import{encodeBackSlashes as A,safeSlugify as D}from"../../../utils/string.js";import{joinWithSeparator as S,toRelativePath as N}from"../../../utils/url.js";import{extractMarkdownSections as R,buildMarkdownSectionItem as v}from"../../utils/markdoc.js";import{buildGroupContent as L}from"./content.js";import{addOperationItems as k}from"../items/operation/item.js";import{addSchemaDefinitionItems as B}from"../items/schema/item.js";import{addMcpItems as W}from"../items/mcp/item.js";import{openApiContext as p}from"../buildContext.js";function tt(t,n){const s=p.get(),o=U(s.tagsMap),e=j(t),r=t["x-tagGroups"];o.size>0?G(e,o,n):r?.length?H(r,n):G(e,o,n)}function H(t,n){const s=p.get();for(const o of t){n.push({type:"separator",label:o.name,[f]:o[f],content:null});for(const e of o.tags||[]){const r=s.tagsMap.get(e);r&&O(e,r,n,[],void 0,o[f])}}}function G(t,n,s){const o=p.get(),e=new Set;for(const r of t)if(!n.has(r)){const a=o.tagsMap.get(r);a&&E(r,a,s,e)}}function C(t){return t.kind==="badge"||t.kind==="audience"}function x(t,n){return S(t,A(D(n).toLowerCase()))}function U(t){const n=new Set;for(const s of t.values()){const{tag:o}=s;o.parent&&!C(o)&&n.add(o.name)}return n}function j(t){const n=p.get(),s=(t.tags||[]).map(e=>e.name);s.includes(b)||s.push(b);const o=n.options.schemaDefinitionsTagName;o&&!s.includes(o)&&s.push(o);for(const e of n.collectedTagOrder)s.includes(e)||s.push(e);return s}function E(t,n,s,o,e=_,r,a){const i=p.get();if(o.has(t)||C(n.tag))return;if(e>w){console.warn("Tags exceed the maximum nesting level.");return}o.add(t);const d=x(r??i.basePath,t),m=n.tag[f]??a,u=[];for(const g of n.children){const c=i.tagsMap.get(g);c&&E(g,c,u,o,e+1,d,m)}O(t,n,s,u,d,a)}function z(t){const n=p.get(),s=[];let o=n.tagsMap.get(t)?.tag;for(;o?.parent;){const e=n.tagsMap.get(o.parent);if(!e)break;s.unshift({label:e.tag.summary||e.tag["x-displayName"]||e.tag.name}),o=e.tag}return s}function O(t,n,s,o,e,r){const a=p.get(),{tag:i,operations:d,description:m}=n,u=i[f]??r;if(t===""){k({operations:d,result:s});return}e||(e=x(a.basePath,t));const g=i.summary||i["x-displayName"]||t,c=[],h=[];B({tagName:t,tagSlug:e,result:c,groupItems:h});const I={tools:[],resources:[],prompts:[]};if(W({tagName:t,tagSlug:e,result:c,groupItems:I}),m&&a.processContent){const l=N(e,a.basePath);for(const P of R(m,a.options,l,!!t))c.push(v({heading:P,basePath:a.basePath}))}if(k({operations:d,result:c,basePath:e,parentRbac:u}),c.push(...o),t===b&&c.length===0)return;const y=z(t),M=n.children.map(l=>{const T=a.tagsMap.get(l)?.tag;return{displayName:T?.summary||T?.["x-displayName"]||l,summary:T?.summary,slug:x(e,l)}});s.push({type:"group",label:g,link:e,routeSlug:e,items:c,[f]:u,content:a.processContent?L({tag:i,tagName:t,headerLabel:g,description:m,operations:d,schemasItems:h.length>0?h:void 0,mcpItems:I,tagSlug:e,basePath:a.basePath,breadcrumbs:y.length>0?y:void 0,childTags:M.length>0?M:void 0,markdownOptions:a.options,feedback:a.options.feedback}):null})}export{tt as addTagItems,G as processRootTags,H as processTagGroups};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as T}from"@redocly/config";import{encodeBackSlashes as x,safeSlugify as R}from"../../../../utils/string.js";import{joinWithSeparator as k,normalizePath as g,toRelativePath as w}from"../../../../utils/url.js";import{readRbacScope as S,rbacProp as d}from"../../../helpers.js";import{buildSchemaDefinitionContent as N}from"./content.js";import{openApiContext as P}from"../../buildContext.js";function A(r,
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as T}from"@redocly/config";import{encodeBackSlashes as x,safeSlugify as R}from"../../../../utils/string.js";import{joinWithSeparator as k,normalizePath as g,toRelativePath as w}from"../../../../utils/url.js";import{readRbacScope as S,rbacProp as d}from"../../../helpers.js";import{buildSchemaDefinitionContent as N}from"./content.js";import{openApiContext as P}from"../../buildContext.js";function A(m,r,s){const n=r.components?.schemas;if(!n)return[];const t=s?[s]:[],o=[];for(const[c,i]of Object.entries(n)){if(c===T)continue;const a=i["x-tags"];(a?.length?a:t).includes(m)&&o.push(c)}return o}function O({tagName:m,tagSlug:r,result:s,groupItems:n}){const{document:t,options:o,processContent:c,basePath:i}=P.get(),f=A(m,t,o.schemaDefinitionsTagName),a=S(t.components?.schemas);for(const e of f){const l=t.components?.schemas?.[e],h=l?.title??e,b=x(R(e).toLowerCase()||e.toLowerCase()),p=g(k(r,b)),u=S(l)??a,C={type:"link",label:h,link:p,routeSlug:p,httpVerb:"schema",content:c?N(e,h,o):null,...d(u)};s.push(C),n?.push({title:h,link:g(w(p,i)),deprecated:!1,...d(u)})}}export{O as addSchemaDefinitionItems,A as getSchemaNamesForTag};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{contentType as
|
|
1
|
+
import{contentType as v,itemVariant as N,nodeTypes as u}from"../../types/common.js";import{safeSlugify as x}from"../../utils/string.js";import{parseMarkdown as p}from"./parseMarkdown.js";import{isPlainText as k}from"./isPlainText.js";import{joinWithSeparator as a}from"../../utils/url.js";import{buildDeepLinkUrl as O}from"../../utils/deep-link.js";import{getDOMPurify as E}from"./dompurify.js";function L(t){return t.type==="tag"&&t.tag==="schemaDefinition"}const W=/^[ \t]{0,3}#{1,6}[ \t]/m;function M(t){const r=t.search(W);return r===-1?t:t.slice(0,r)}function X(t,r){if(typeof t=="string"){const n=M(t).trim();if(k(n))return n}const e=p(t,r);if(!e)return;if(typeof e=="string")return e;if(Array.isArray(e)){const n=e.findIndex(o=>o.type==="heading");return n===-1?e:e.slice(0,n)}if(!e.children||!Array.isArray(e.children))return;const i=e.children.findIndex(n=>n.type==="heading");return i===-1?[e]:(e.children=e.children.slice(0,i),[e])}function Y(t,r,{sliceAtFirstHeading:e=!1}={}){if(typeof t=="string"&&e){const f=M(t).trim();if(k(f))return[{kind:"markdoc",node:{nodeType:u.MARKDOC,content:f}}]}const i=p(t,r);if(!i)return[];if(typeof i=="string")return[{kind:"markdoc",node:{nodeType:u.MARKDOC,content:i}}];let n=Array.isArray(i)?i:i.children??[];if(e){const f=n.findIndex(d=>d.type==="heading");f!==-1&&(n=n.slice(0,f))}const o=[];let c=[];const l=()=>{c.length>0&&(o.push({kind:"markdoc",node:{nodeType:u.MARKDOC,content:c}}),c=[])};for(const f of n)L(f)?(l(),o.push({kind:"schemaDefinition",node:{nodeType:u.MARKDOC,content:[f]}})):c.push(f);return l(),o}function _(t,r,e){const i=t.toLowerCase(),n=i.startsWith("section/")?i.slice(8):i,o=r.toLowerCase();let c=n!==o?n:"";return e&&(c=a(e,c)),c}function S(t,...r){let e=t.toLowerCase();for(const i of r){const n=i?`${i.toLowerCase()}/`:"";n&&`${e}/`.startsWith(n)&&(e=e.slice(n.length))}return e}function J(t,r,e){if(typeof t=="string")return;const i=n=>{if(n.type==="heading"&&n.attributes?.level){const o=n.attributes.id?S(n.attributes.id,r,e):x(m(n).trim()).toLowerCase();if(o){const c=_(o,r,e);n.attributes.id=a(r,c).toLowerCase(),n.attributes.deepLinkHash=O("",r,c)}}for(const o of n.children??[])i(o)};if(Array.isArray(t))for(const n of t)i(n);else i(t)}function H(t,r,e,i){const n=p(t,r);if(!n)return[];if(typeof n=="string")return[];const o=[];let c;const l=(s,h,R=o,y,A)=>{s=z(s);const T=A!==void 0,C=T?A:e;let g;y.attributes.id?g=S(y.attributes.id,C):T||i?g=x(s):g=`section/${x(s)}`;const I=a(C,g).toLowerCase();y.attributes.id=I;const b={id:I,name:s,level:h,items:[],ast:[y]};return R.push(b),b},f=s=>{if(typeof s?.attributes?.content=="string")return s.attributes.content;if(s?.children)return f(s.children[0])},d=s=>{const h=f(s)||"";s.type==="heading"&&s.attributes?.level===1?c=l(h,s.attributes.level,void 0,s):s.attributes?.level?l(h,s.attributes.level,c?.items,s,c?.id):c?.items?.length?c.items[c.items.length-1]?.ast?.push(s):o.length&&o[o.length-1]?.ast?.push(s)};if(Array.isArray(n))for(const s of n)d(s);else if(n.children)for(const s of n.children)d(s);return o}function K({heading:t,basePath:r}){const e=t.items.length>0,i=a(r,t.id).toLowerCase(),n=e?t.items.map(o=>K({heading:o,basePath:r})):[];return{type:e?"group":"link",label:t.name,link:i,routeSlug:i,items:e?n:void 0,content:P(t)}}function Q(t,r,e){const i=[],n=[];for(const o of H(t,e,"")){const{item:c,children:l}=w(o,r);i.push(c),n.push(...l)}return{sectionItems:i,sectionChildren:n}}function w(t,r){const e=a(r,t.id),i=t.items.length>0,n=t.ast?.length?[V(t.ast,a(r,t.id))]:[],o=[];for(const l of t.items){const{item:f,children:d}=w(l,r);o.push(f);const s=a(r,l.id);n.push({nodeType:u.OVERVIEW_SECTION_WRAPPER,children:d,sectionId:s})}return{item:{type:i?"group":"link",label:t.name,link:e,routeSlug:e,items:i?o:void 0,content:null},children:n}}function Z(t){return typeof t=="string"?t.trim():Array.isArray(t)?t.map(r=>m(r)).filter(Boolean).join(" ").trim():m(t).trim()}function D(t,r=50){if(typeof t=="string"){const o=t.split(/\n[ \t]*\n/)[0].replace(/\s+/g," ").trim();return o?o.substring(0,r):void 0}const i=(Array.isArray(t)?t:t.children??[t])[0];if(!i)return;const n=m(i);return n?n.substring(0,r):void 0}function tt(t,r){if(!t)return;const e=p(t,r);if(!e)return;const i=D(e);return i?i.length===50?i+"\u2026":i:void 0}function et(t,r){if(!t)return;const e=p(t,r);if(e)return D(e,Number.POSITIVE_INFINITY)}function m(t){const r=[];function e(i){typeof i.attributes?.content=="string"&&r.push(i.attributes.content);for(const n of i.children??[])e(n)}return e(t),r.join("")}function nt(t){return typeof t=="string"?t.trim():(Array.isArray(t)?t:[t]).map(e=>m(e)).join("").trim()}function z(t){return t.replace(/&#(\d+);/g,(r,e)=>String.fromCharCode(parseInt(e,10))).replace(/"/g,'"').replace(/&/g,"&")}function rt(t,r){const{unstable_hooks:e,sanitize:i}=r??{};return e?.sanitize?e.sanitize(t):i?E().sanitize(t):t}function P(t){const r=[];return t.ast&&t.ast.length>0&&r.push({nodeType:u.MARKDOC,content:t.ast}),{contentType:v.ITEM,itemVariant:N.MARKDOWN,meta:{name:t.name},children:[{nodeType:u.CONTAINER,children:r,panels:[]}]}}function V(t,r){return{nodeType:u.OVERVIEW_SECTION_WRAPPER,children:[{nodeType:u.MARKDOC,content:t}],sectionId:r}}export{K as buildMarkdownSectionItem,nt as collectMarkdownPlainText,Q as collectMarkdownSections,X as extractContentUntilFirstHeading,Y as extractDescriptionSegments,D as extractFirstParagraphText,Z as extractFullText,H as extractMarkdownSections,et as extractSeoDescriptionText,tt as extractSummaryText,_ as resolveMarkdocHeadingDeepSuffix,J as resolveMarkdocHeadingIds,rt as sanitizeMarkdownSource,z as unescapeHTMLChars};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a={for:"htmlFor",class:"className","accept-charset":"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",allowtransparency:"allowTransparency",autocomplete:"autoComplete",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",classid:"classID",colspan:"colSpan",contenteditable:"contentEditable",contextmenu:"contextMenu",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang","http-equiv":"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",playsinline:"playsInline",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap",autocapitalize:"autoCapitalize",autocorrect:"autoCorrect",autosave:"autoSave",itemprop:"itemProp",itemscope:"itemScope",itemtype:"itemType",itemid:"itemID",itemref:"itemRef","accent-height":"accentHeight","alignment-baseline":"alignmentBaseline","arabic-form":"arabicForm","baseline-shift":"baselineShift","cap-height":"capHeight","clip-path":"clipPath","clip-rule":"clipRule","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","color-profile":"colorProfile","color-rendering":"colorRendering","dominant-baseline":"dominantBaseline","enable-background":"enableBackground","fill-opacity":"fillOpacity","fill-rule":"fillRule","flood-color":"floodColor","flood-opacity":"floodOpacity","font-family":"fontFamily","font-size":"fontSize","font-size-adjust":"fontSizeAdjust","font-stretch":"fontStretch","font-style":"fontStyle","font-variant":"fontVariant","font-weight":"fontWeight","glyph-name":"glyphName","glyph-orientation-horizontal":"glyphOrientationHorizontal","glyph-orientation-vertical":"glyphOrientationVertical","horiz-adv-x":"horizAdvX","horiz-origin-x":"horizOriginX","image-rendering":"imageRendering","letter-spacing":"letterSpacing","lighting-color":"lightingColor","marker-end":"markerEnd","marker-mid":"markerMid","marker-start":"markerStart","overline-position":"overlinePosition","overline-thickness":"overlineThickness","paint-order":"paintOrder","panose-1":"panose1","pointer-events":"pointerEvents","rendering-intent":"renderingIntent","shape-rendering":"shapeRendering","stop-color":"stopColor","stop-opacity":"stopOpacity","strikethrough-position":"strikethroughPosition","strikethrough-thickness":"strikethroughThickness","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-anchor":"textAnchor","text-decoration":"textDecoration","text-rendering":"textRendering","underline-position":"underlinePosition","underline-thickness":"underlineThickness","unicode-bidi":"unicodeBidi","unicode-range":"unicodeRange","units-per-em":"unitsPerEm","v-alphabetic":"vAlphabetic","v-hanging":"vHanging","v-ideographic":"vIdeographic","v-mathematical":"vMathematical","vector-effect":"vectorEffect","vert-adv-y":"vertAdvY","vert-origin-x":"vertOriginX","vert-origin-y":"vertOriginY","word-spacing":"wordSpacing","writing-mode":"writingMode","x-height":"xHeight","xlink:actuate":"xlinkActuate","xlink:arcrole":"xlinkArcrole","xlink:href":"xlinkHref","xlink:role":"xlinkRole","xlink:show":"xlinkShow","xlink:title":"xlinkTitle","xlink:type":"xlinkType","xml:base":"xmlBase","xmlns:xlink":"xmlnsXlink","xml:lang":"xmlLang","xml:space":"xmlSpace"};function s(r,t){const e={};for(const[i,n]of Object.entries(r))switch(i){case"value":t==="input"||t==="textarea"?e.defaultValue=n:e.value=n;break;case"checked":t==="input"?e.defaultChecked=!0:e.checked=n;break;case"style":e.style=c(n);break;default:e[a[i]||i]=n}return e}function l(r){return r.match(/^--/)?r:r.replace(/-[a-z]/g,t=>t[1].toUpperCase())}function c(r){return r.split(";").filter(t=>t.trim().length).reduce((t,e)=>{const i=e.indexOf(":"),n=i===-1?e:e.slice(0,i),o=i===-1?"":e.slice(i+1);return t[l(n.trim())]=o.trim(),t},{})}export{s as getJsxConvertedAttributes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function processHtmlTokens(tokens: any): any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Parser as p}from"htmlparser2";import{getJsxConvertedAttributes as i}from"./html-jsx-attribute-mapping.js";function l(r){const e=[],n=[];let o=null;const s=new p({onopentag(t,a){n.push({name:t,token:o}),e.push({type:"tag_open",nesting:1,meta:{tag:"html",attributes:[{type:"attribute",name:"name",value:t},{type:"attribute",name:"attrs",value:i(a,t)}]}})},ontext(t){t?.trim().length>0&&e.push({type:"text",content:t})},onclosetag(){n.pop(),e.push({type:"tag_close",nesting:-1,meta:{tag:"html"}})}});for(const t of r){if(t.type.startsWith("html")){o=t,s.write(t.content);continue}t.type==="inline"&&(t.children=l(t.children)),e.push(t)}for(const t of n)e.push({type:"error",meta:{error:{message:`HTML tag <${t.name}> is not closed, opened at`,location:t?.token?.map?{start:{line:t.token.map[0]},end:{line:t.token.map[1]}}:void 0}}}),e.push({type:"tag_close",nesting:-1,meta:{tag:"html"}});return e}export{l as processHtmlTokens};
|
|
@@ -2,5 +2,7 @@ import type { MarkdownParser } from '../../adapters/utils/parseMarkdown.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* The default Markdoc-based {@link MarkdownParser}, supplied by the standalone build. api-docs core
|
|
4
4
|
* stays free of a markdown engine; callers of `buildItems` pass this in (or their own parser).
|
|
5
|
+
* Raw HTML in the source is tokenized and converted into `{% html %}` tag nodes, so it renders as
|
|
6
|
+
* elements and never leaks markup into extracted text.
|
|
5
7
|
*/
|
|
6
8
|
export declare const markdocParser: MarkdownParser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"@markdoc/markdoc";import{sanitizeMarkdownSource as m}from"../../adapters/utils/markdoc.js";import{simplifyAstStructure as s}from"../../adapters/utils/simplifyAstStructure.js";import{processHtmlTokens as i}from"./html/process-html-tokens.js";const e=new r.Tokenizer({html:!0,allowIndentation:!0,allowComments:!0});e.parser.block.ruler.getRules("reference").length=0;const p=(o,t)=>{const n=e.tokenize(m(o,t));return s(r.parse(i(n)))};export{p as markdocParser};
|
|
@@ -57,7 +57,7 @@ import{styled as t,css as i}from"styled-components";import{Button as n}from"@red
|
|
|
57
57
|
${({$active:e})=>e&&i`
|
|
58
58
|
&::before {
|
|
59
59
|
position: absolute;
|
|
60
|
-
top: -
|
|
60
|
+
top: calc(-1 * var(--spacing-sm) - 1px);
|
|
61
61
|
border-top: 3px solid var(--text-color-primary);
|
|
62
62
|
width: 100%;
|
|
63
63
|
content: '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildCodeSampleSourceFromDocument as
|
|
1
|
+
import{buildCodeSampleSourceFromDocument as S}from"./from-openapi-document.js";import{mergeConfigureIntoSourceForReplay as v,pickRuntimeConfigureRequestValues as C}from"./merge-configure-into-source.js";import{createReplayConverter as R,toReplayOperation as b}from"./replay-adapter.js";import{applyRequestValuesToOperationInfo as k}from"../../../adapters/openapi/configure/apply-request-values.js";import{mergeInMockServer as O,pickOperationServers as q}from"../../../adapters/openapi/utils/merge-mock-server.js";import{openApiContext as w}from"../../../adapters/openapi/buildContext.js";function x(c,u,n){return{storeCtx:c,document:u,options:n,basePath:"/",downloadUrls:[],tagsMap:new Map,collectedTagOrder:[],badgeTags:[],processContent:!0}}function A(c,u,n,f,m,l){const p=C(n,f),s=p?e=>v(e,p,m):void 0,d=l?(e,a,r)=>{const t=l(e,r);if(!t||Object.keys(t).length===0)return;const i=q(e.servers,r.servers).filter(y=>typeof y?.url=="string"),o=O(i,n.mockServer);w.run(x(a,r,n),()=>k(e,t,o))}:void 0,g=R(c,u,s);return(e,a,r)=>{try{const o=g(e,a,r);if(o)return o}catch(o){console.error("[Replay] createReplayConverter error:",o)}if(!r||typeof r!="object")return;const t=S(e,a,r,n,d);if(!t)return;const i=s?s(t):t;return b(i,u)}}export{A as createReplayOverlayConverter};
|
package/lib/types/openapi.d.ts
CHANGED
|
@@ -573,7 +573,6 @@ export type OpenApiBuildContext = {
|
|
|
573
573
|
downloadUrls?: NormalizedDownloadUrl[];
|
|
574
574
|
basePath: string;
|
|
575
575
|
tagsMap: Map<string, TagData>;
|
|
576
|
-
hasTopLevelTags: boolean;
|
|
577
576
|
collectedTagOrder: string[];
|
|
578
577
|
storeCtx: StoreContext;
|
|
579
578
|
badgeTags: OpenAPITag[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/api-docs",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.2",
|
|
4
4
|
"description": "Redocly API Documentation Library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"dompurify": "3.4.13",
|
|
36
36
|
"fast-xml-parser": "5.7.3",
|
|
37
37
|
"graphql": "16.14.2",
|
|
38
|
+
"htmlparser2": "8.0.2",
|
|
38
39
|
"jotai": "^2.16.2",
|
|
39
40
|
"jotai-family": "1.0.1",
|
|
40
41
|
"js-yaml": "4.3.1",
|
|
@@ -47,11 +48,11 @@
|
|
|
47
48
|
"swagger2openapi": "^7.0.8",
|
|
48
49
|
"url-template": "^2.0.8",
|
|
49
50
|
"web-vitals": "3.3.1",
|
|
50
|
-
"@redocly/redoc-opentelemetry": "0.2.2",
|
|
51
|
-
"@redocly/replay": "0.28.0-next.1",
|
|
52
|
-
"@redocly/theme": "^0.69.0-next.1",
|
|
53
51
|
"@redocly/allof-merge": "0.6.9",
|
|
54
|
-
"@redocly/config": "0.53.1"
|
|
52
|
+
"@redocly/config": "0.53.1",
|
|
53
|
+
"@redocly/redoc-opentelemetry": "0.2.2",
|
|
54
|
+
"@redocly/replay": "0.28.0-next.2",
|
|
55
|
+
"@redocly/theme": "^0.69.0-next.2"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@testing-library/jest-dom": "6.6.3",
|