@redocly/api-docs 0.1.0-next.3 → 0.1.0-next.4
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/.tsbuildinfo +1 -1
- package/lib/adapters/openapi/items/operation/content.d.ts +9 -0
- package/lib/adapters/openapi/items/operation/content.js +1 -1
- package/lib/adapters/utils/markdoc.js +1 -1
- package/lib/components/ItemContent/hooks.js +1 -1
- package/lib/components/ItemContent/sections/BodySection.js +3 -3
- package/lib/components/ItemContent/sections/CallbacksSection.js +19 -19
- package/lib/components/ItemContent/sections/ParametersSection.js +2 -2
- package/lib/components/ItemContent/sections/ResponsesSection.js +8 -8
- package/lib/components/Schema/hooks/useSchemaFieldDeepLink.js +1 -1
- package/lib/components/markdoc/Heading.d.ts +1 -1
- package/lib/components/markdoc/Heading.js +3 -3
- package/lib/components/markdoc/defaultMarkdocConfig.js +1 -1
- package/lib/components/panels/ExampleItem/CallbackPayloadItem.js +2 -2
- package/lib/hooks/useApiDocsScroll.js +1 -1
- package/lib/hooks/useDeepLinkSection.d.ts +11 -4
- package/lib/hooks/useDeepLinkSection.js +1 -1
- package/lib/jotai/app.d.ts +0 -3
- package/lib/jotai/app.js +1 -1
- package/lib/jotai/itemStore.d.ts +1 -0
- package/lib/jotai/itemStore.js +1 -1
- package/lib/utils/deep-link.d.ts +22 -0
- package/lib/utils/deep-link.js +1 -1
- package/package.json +1 -1
package/lib/utils/deep-link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{encodeBackSlashes as
|
|
1
|
+
import{encodeBackSlashes as h,tryDecodeURIComponent as s}from"./string.js";import{joinWithSeparator as i,normalizePath as f}from"./url.js";import{resolveRouteByPathname as L}from"./routing.js";function p(t){const e=[];for(const[n,r]of Object.entries(t))r!==void 0&&e.push(`${n}=${r}`);return e.join("&")}function $(t,e){return t=h(t).replace(/^\/+/,""),(`/${t}#`+i(t,e)).toLowerCase()}function y(t,e,n){const r=$(e,n);return f(i(t,r))}function d(t){const e=t.startsWith("#")?t.slice(1):t;return s(e).toLowerCase()}function k(t){const e=s(t),n=e.indexOf("#");return n>=0?e.slice(n+1):""}function N(t){return p({t:t.t,in:t.in,c:t.c,cb:t.cb,ct:t.ct,path:t.path})}function _(t,e,n){let r=t;return n&&(r=`${r}&c=${n}`),e&&(r=i(r,e)),r}function K(t){const{section:e,messageKey:n,subsection:r}=t;if(!n)return e;let o=`${e}&m=${n}`;return r&&(o+=`&t=${r}`),o}function B(t){return p({t:t.t,path:t.path,arg:t.arg,rt:t.rt})}function D(t,e){return!t||!e?!1:s(t.startsWith("#")?t.slice(1):t).toLowerCase().includes(`path=${e.toLowerCase()}.`)}function P(t){return t&&k(t)||void 0}function F(t,e){const n=[...t??[]];return n.length>0?n[n.length-1]+=e:n.push(e),n}const S=/&(?:oneof|d)=\d+/g;function M(t){return t.replace(S,"")}function v(t){return t.replace(/\[\]/g,"")}function z(t){return(t??[]).filter(e=>e.includes("&")).map(e=>e.slice(e.indexOf("&")))}function H(t,e){return t?s(t.startsWith("#")?t.slice(1):t).toLowerCase().match(new RegExp(`(?:^|[&/])${e}=([^/&]+)`))?.[1]:void 0}const m="callbacks",u=`${m}/`,A="callback-request",b="callback-response",g=[`/${A}`,`/${b}`];function a(t){const e=t.indexOf("path=");return e===-1?t:t.slice(0,e)}function I(t){return t.replace(`/${u}`,"/")}function x(t,e){const n=`cb=${e}`;return t.endsWith(n)||t.includes(`${n}&`)}function E(t,e){const n=`/${e}`;return t.endsWith(n)||t.includes(`${n}/`)}function w(t,e){return t===e||t.startsWith(`${e}/`)}function j(t,e,n){if(!t||!e||!n)return!1;const r=d(t);if(!w(r,e))return!1;const o=a(r),c=n.toLowerCase();return x(o,c)||E(o,c)}function q(t,e,n){const r=a(t),o=n.toLowerCase();return r.startsWith(i(e,`${u}${o}/`))||r.startsWith(i(e,`${o}/`))||x(r,o)}function G(t,e){const n=a(t).slice(e.length);return!(n.startsWith(`/${u}`)||n.includes("cb=")||g.some(o=>n.includes(o)))}function O(t){const e=["#tag","#operation","#paths"];for(const n of e)if(t.includes(n))return t.replace(n,"").toLowerCase();return""}function U(t,e,n){const r=d(t);if(!r)return;const o=f(i(e,r));if(L(n,o))return o;const c=O(t);if(c){const l=n.allRoutes.find(C=>C.path.toLowerCase().endsWith(c));if(l)return l.path}}export{m as CALLBACKS_SECTION,A as CALLBACK_REQUEST_SECTION,b as CALLBACK_RESPONSE_SECTION,F as appendVariantSuffix,K as buildAsyncApiSuffix,y as buildDeepLinkUrl,B as buildGraphqlSuffix,N as buildOpenApiFieldSuffix,_ as buildOpenApiSectionSuffix,k as deepLinkToId,H as extractDeepLinkParamFromHash,P as getDeepLinkId,O as getLegacyHash,w as hashIsForItem,q as hashIsInsideCallback,G as hashIsOutsideCallbacks,j as hashTargetsCallback,d as hashToElementId,D as isGraphqlDeepLinkAncestor,$ as makeDeepLink,U as resolveLegacyHashToRoute,p as serializeFieldParams,v as stripArrayMarkers,I as stripCallbacksSegment,M as stripVariantMarkers,z as variantMarkersOnly};
|