@redocly/api-docs 0.1.0-next.2 → 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.
Files changed (42) hide show
  1. package/lib/.tsbuildinfo +1 -1
  2. package/lib/adapters/openapi/items/operation/content.d.ts +9 -0
  3. package/lib/adapters/openapi/items/operation/content.js +1 -1
  4. package/lib/adapters/utils/markdoc.js +1 -1
  5. package/lib/components/ItemContent/hooks.js +1 -1
  6. package/lib/components/ItemContent/sections/BodySection.js +3 -3
  7. package/lib/components/ItemContent/sections/CallbacksSection.js +19 -19
  8. package/lib/components/ItemContent/sections/ParametersSection.js +2 -2
  9. package/lib/components/ItemContent/sections/ResponsesSection.js +8 -8
  10. package/lib/components/MessageLinksItem.js +1 -1
  11. package/lib/components/Schema/hooks/useSchemaFieldDeepLink.js +1 -1
  12. package/lib/components/Schema/styled.d.ts +1 -1
  13. package/lib/components/Schema/styled.js +3 -4
  14. package/lib/components/SideMenu/useMenuItems.js +1 -1
  15. package/lib/components/common/DeepLinkAnchor.js +1 -1
  16. package/lib/components/graphql/GraphQLGroupTypeList.js +1 -1
  17. package/lib/components/graphql/GraphQLReturnTypeDetails.js +1 -1
  18. package/lib/components/markdoc/Heading.d.ts +1 -1
  19. package/lib/components/markdoc/Heading.js +3 -3
  20. package/lib/components/markdoc/defaultMarkdocConfig.js +1 -1
  21. package/lib/components/panels/ExampleItem/CallbackPayloadItem.js +2 -2
  22. package/lib/components/panels/ReferencesPanelItem.js +1 -1
  23. package/lib/components/panels/asyncapi/MessageReferencesItem/MessageReferencesItem.js +1 -1
  24. package/lib/hoc/withRouter.js +1 -1
  25. package/lib/hooks/useApiDocsScroll.js +1 -1
  26. package/lib/hooks/useDeepLinkSection.d.ts +11 -4
  27. package/lib/hooks/useDeepLinkSection.js +1 -1
  28. package/lib/hooks/useHashLinkRedirect.js +1 -1
  29. package/lib/hooks/useIsExpanded.js +1 -1
  30. package/lib/hooks/useRouterHashBridge.js +1 -1
  31. package/lib/hooks/useScrollSpyUrlSync.js +1 -1
  32. package/lib/hooks/useVisitedChannelsTracker.js +1 -1
  33. package/lib/jotai/app.d.ts +0 -3
  34. package/lib/jotai/app.js +1 -1
  35. package/lib/jotai/itemStore.d.ts +1 -0
  36. package/lib/jotai/itemStore.js +1 -1
  37. package/lib/pages/EntryPage.js +1 -1
  38. package/lib/pages/GroupPage.js +1 -1
  39. package/lib/pages/NotFoundPage.js +1 -1
  40. package/lib/utils/deep-link.d.ts +22 -0
  41. package/lib/utils/deep-link.js +1 -1
  42. package/package.json +9 -9
@@ -1 +1 @@
1
- import{useEffect as R,useLayoutEffect as h}from"react";import{useLocation as T,useNavigate as w}from"react-router-dom";import{IS_BROWSER as p}from"@redocly/theme/core/openapi";import{SECTION_ATTR as y}from"../constants/openapi.js";import{hashToElementId as v,resolveLegacyHashToRoute as S,stripArrayMarkers as L}from"../utils/deep-link.js";import{USER_SCROLL_INTENT_EVENTS as H,WHEEL_INTENT_THRESHOLD_PX as _,createScrollIntentTracker as b}from"./useUserScrollIntent.js";function $({activeRoute:t,routeIndex:e,basePath:o,isHydrated:i}){const c=T(),u=w(),s=t?.path;R(()=>{if(!p||!("scrollRestoration"in window.history))return;const r=window.history.scrollRestoration;return window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration=r}},[]),h(()=>{if(!p)return;const{hash:r}=c,l=r?v(r):"";if(l&&!g(l)){const f=S(r,o,e);if(f&&f!==c.pathname){u(f,{replace:!0});return}}if(!(!l&&!s))return A(I(l,s))},[c,s,i,u,o,e])}function I(t,e){if(!t)return()=>m(e);let o=!1;return()=>{const i=g(t);return i?(o=!0,i):o?null:m(e)}}const N=_;function A(t){let e=t();if(e?.scrollIntoView({block:"start"}),typeof ResizeObserver>"u")return()=>{};const o=document.documentElement,i=new AbortController;let c=e?e.getBoundingClientRect().top:0,u=o.scrollHeight;function s(n){e=n,n.scrollIntoView({block:"start"}),c=n.getBoundingClientRect().top,u=o.scrollHeight}const r=new ResizeObserver(()=>{const n=t();n&&s(n)});r.observe(document.body);function l(){e&&(Math.abs(e.getBoundingClientRect().top-c)<=N||(o.scrollHeight===u?a():s(e)))}const f=b();function E(n){f(n)&&a()}function a(){r.disconnect(),i.abort()}const d={capture:!0,passive:!0,signal:i.signal};window.addEventListener("scroll",l,d);for(const n of H)window.addEventListener(n,E,d);return a}function g(t){return t?document.getElementById(t)||C(t)||document.getElementById(t.split("&")[0]):null}function C(t){if(t.includes("[]"))return null;for(const e of document.querySelectorAll('[id*="[]"]'))if(L(e.id)===t)return e;return null}function m(t){if(!t)return null;const e=t.replace(/["\\]/g,"\\$&");return document.querySelector(`[${y}="${e}"]`)}export{$ as useApiDocsScroll};
1
+ import{useEffect as h,useLayoutEffect as m}from"react";import{useLocation as y,useNavigate as T}from"react-router";import{IS_BROWSER as g}from"@redocly/theme/core/openapi";import{SECTION_ATTR as w}from"../constants/openapi.js";import{hashToElementId as S,resolveLegacyHashToRoute as v,stripArrayMarkers as L,stripCallbacksSegment as b}from"../utils/deep-link.js";import{USER_SCROLL_INTENT_EVENTS as H,WHEEL_INTENT_THRESHOLD_PX as _,createScrollIntentTracker as A}from"./useUserScrollIntent.js";function M({activeRoute:t,routeIndex:n,basePath:e,isHydrated:r}){const i=y(),u=T(),l=t?.path;h(()=>{if(!g||!("scrollRestoration"in window.history))return;const c=window.history.scrollRestoration;return window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration=c}},[]),m(()=>{if(!g)return;const{hash:c}=i,s=c?S(c):"";if(s&&!p(s)){const a=v(c,e,n);if(a&&a!==i.pathname){u(a,{replace:!0});return}}if(!(!s&&!l))return N(C(s,l))},[i,l,r,u,e,n])}function C(t,n){if(!t)return()=>R(n);let e=!1;return()=>{const r=p(t);return r?(e=!0,r):e?null:R(n)}}const k=_;function N(t){let n=t();if(n?.scrollIntoView({block:"start"}),typeof ResizeObserver>"u")return()=>{};const e=document.documentElement,r=new AbortController;let i=n?n.getBoundingClientRect().top:0,u=e.scrollHeight;function l(o){n=o,o.scrollIntoView({block:"start"}),i=o.getBoundingClientRect().top,u=e.scrollHeight}const c=new ResizeObserver(()=>{const o=t();o&&l(o)});c.observe(document.body);function s(){n&&(Math.abs(n.getBoundingClientRect().top-i)<=k||(e.scrollHeight===u?f():l(n)))}const a=A();function E(o){a(o)&&f()}function f(){c.disconnect(),r.abort()}const d={capture:!0,passive:!0,signal:r.signal};window.addEventListener("scroll",s,d);for(const o of H)window.addEventListener(o,E,d);return f}function p(t){if(!t)return null;const n=t.split("&")[0],e=n===t?[t]:[t,n];for(const r of e){const i=document.getElementById(r)??O(r);if(i)return i}return null}function O(t){return I(t)??B(t)}function I(t){if(t.includes("[]"))return null;for(const n of document.querySelectorAll('[id*="[]"]'))if(L(n.id)===t)return n;return null}function B(t){if(t.includes("/callbacks/"))return null;for(const n of document.querySelectorAll('[id*="/callbacks/"]'))if(b(n.id)===t)return n;return null}function R(t){if(!t)return null;const n=t.replace(/["\\]/g,"\\$&");return document.querySelector(`[${w}="${n}"]`)}export{M as useApiDocsScroll};
@@ -1,5 +1,10 @@
1
1
  import type { DeepLinkSectionData } from '../jotai/itemStore.js';
2
2
  export declare const ItemIdContext: import("react").Context<string | undefined>;
3
+ /** Callback id of the enclosing callback panel, if any. See
4
+ * `brain/legacy-deep-link-back-compat.md` § Callbacks for the id formats. */
5
+ export declare const CallbackScopeContext: import("react").Context<string | undefined>;
6
+ export declare function useCallbackScope(): string | undefined;
7
+ export declare function useHashItemId(): string;
3
8
  /** Marks an `ItemIdContext` value as a synthetic per-mount id (not a route
4
9
  * path). Pluggable components (e.g. `RedocSchema`) provide one purely so the
5
10
  * oneOf/discriminator switchers can key itemStore state — deep-link building
@@ -9,8 +14,10 @@ export declare const SYNTHETIC_ITEM_ID_PREFIX = "synthetic-item:";
9
14
  * it comes from `ItemIdContext` separately. `null` means "no section". */
10
15
  export type DeepLinkSectionValue = Omit<DeepLinkSectionData, 'id'>;
11
16
  export declare const DeepLinkSectionContext: import("react").Context<DeepLinkSectionValue | null>;
12
- /** Build a normalized deep-link URL for the current item using its
13
- * `ItemIdContext` and the given suffix. Returns `''` when no item is in
14
- * scope (e.g. rendered outside a page wrapper) or when the itemId is a
15
- * synthetic per-mount id (see {@link SYNTHETIC_ITEM_ID_PREFIX}). */
17
+ /** Build a normalized deep-link URL for a *section* of the current item, using its
18
+ * `ItemIdContext` and the given suffix. Inside a callback the suffix is prefixed with
19
+ * `callbacks/<callbackId>` so the section cannot collide with the parent operation's.
20
+ * Returns `''` when no item is in scope (e.g. rendered outside a page wrapper) or when the
21
+ * itemId is a synthetic per-mount id (see {@link SYNTHETIC_ITEM_ID_PREFIX}). */
16
22
  export declare function useDeepLinkUrl(suffix: string): string;
23
+ export declare function useFieldDeepLinkUrl(suffix: string): string;
@@ -1 +1 @@
1
- import{createContext as n,useContext as m,useMemo as s}from"react";import{useAtomValue as u}from"jotai";import{routingBasePathAtom as a}from"../jotai/store.js";import{buildDeepLinkUrl as p}from"../utils/deep-link.js";import{toRelativePath as l}from"../utils/url.js";import{useNavigationUrlNormalizer as c}from"./useNormalizeUrl.js";const f=n(void 0),x="synthetic-item:",P=n(null);function U(o){const t=m(f),e=u(a),r=c();return s(()=>{if(!t||t.startsWith(x))return"";const i=e?l(t,e):t;return r(p(e,i,o))},[t,e,o,r])}export{P as DeepLinkSectionContext,f as ItemIdContext,x as SYNTHETIC_ITEM_ID_PREFIX,U as useDeepLinkUrl};
1
+ import{createContext as i,useContext as u,useMemo as c}from"react";import{useAtomValue as p}from"jotai";import{routingBasePathAtom as a}from"../jotai/store.js";import{buildDeepLinkUrl as I,buildOpenApiSectionSuffix as C,CALLBACKS_SECTION as S}from"../utils/deep-link.js";import{joinWithSeparator as h,toRelativePath as m}from"../utils/url.js";import{useNavigationUrlNormalizer as L}from"./useNormalizeUrl.js";const l=i(void 0),k=i(void 0);function D(){return u(k)}function P(){const t=u(l),e=p(a);return c(()=>t?m(t,e).toLowerCase():"",[t,e])}const U="synthetic-item:",T=i(null);function f(t,e){const o=u(l),r=D(),n=p(a),s=L();return c(()=>{if(!o||o.startsWith(U))return"";const d=n?m(o,n):o,x=e&&r?h(C(S,r),t):t;return s(I(n,d,x))},[o,r,e,n,t,s])}function _(t){return f(t,!0)}function v(t){return f(t,!1)}export{k as CallbackScopeContext,T as DeepLinkSectionContext,l as ItemIdContext,U as SYNTHETIC_ITEM_ID_PREFIX,D as useCallbackScope,_ as useDeepLinkUrl,v as useFieldDeepLinkUrl,P as useHashItemId};
@@ -1 +1 @@
1
- import{useCallback as n}from"react";import{useNavigate as c}from"react-router-dom";import{resolveLegacyHashToRoute as s}from"../utils/deep-link.js";function m(i,a){const e=c();return n(o=>{if(o.button!==0||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey)return;const t=o.target.closest("a");if(!t||t.origin!==window.location.origin)return;const r=s(t.hash,i,a);!r||r===window.location.pathname||(o.preventDefault(),e(r))},[i,a,e])}export{m as useHashLinkRedirect};
1
+ import{useCallback as n}from"react";import{useNavigate as c}from"react-router";import{resolveLegacyHashToRoute as s}from"../utils/deep-link.js";function m(i,a){const e=c();return n(o=>{if(o.button!==0||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey)return;const t=o.target.closest("a");if(!t||t.origin!==window.location.origin)return;const r=s(t.hash,i,a);!r||r===window.location.pathname||(o.preventDefault(),e(r))},[i,a,e])}export{m as useHashLinkRedirect};
@@ -1 +1 @@
1
- import{useMemo as s}from"react";import{useLocation as c}from"react-router-dom";import{tryDecodeURIComponent as r}from"../utils/string.js";import{normalizePath as a}from"../utils/url.js";function d(o,e){const n=r(a(e)),m=a(o);return[m,r(m)].some(t=>n===t||n.endsWith(t)||n.includes(t+"/"))}function l(o){const e=c();return s(()=>d(o,e.pathname),[o,e.pathname])}export{l as useIsExpanded};
1
+ import{useMemo as s}from"react";import{useLocation as c}from"react-router";import{tryDecodeURIComponent as r}from"../utils/string.js";import{normalizePath as a}from"../utils/url.js";function d(o,e){const n=r(a(e)),m=a(o);return[m,r(m)].some(t=>n===t||n.endsWith(t)||n.includes(t+"/"))}function l(o){const e=c();return s(()=>d(o,e.pathname),[o,e.pathname])}export{l as useIsExpanded};
@@ -1 +1 @@
1
- import{useEffect as o,useRef as i}from"react";import{useLocation as s}from"react-router-dom";const r="redocly:urlreplace";function h(){const n=s(),t=i(n.hash);o(()=>{if(typeof window>"u")return;const e=()=>{t.current=window.location.hash};return window.addEventListener("hashchange",e),window.addEventListener("popstate",e),window.addEventListener(r,e),()=>{window.removeEventListener("hashchange",e),window.removeEventListener("popstate",e),window.removeEventListener(r,e)}},[]),o(()=>{typeof window>"u"||n.hash!==t.current&&(t.current=n.hash,window.dispatchEvent(new HashChangeEvent("hashchange")))},[n])}export{r as URL_REPLACE_EVENT,h as useRouterHashBridge};
1
+ import{useEffect as o,useRef as i}from"react";import{useLocation as s}from"react-router";const r="redocly:urlreplace";function h(){const n=s(),t=i(n.hash);o(()=>{if(typeof window>"u")return;const e=()=>{t.current=window.location.hash};return window.addEventListener("hashchange",e),window.addEventListener("popstate",e),window.addEventListener(r,e),()=>{window.removeEventListener("hashchange",e),window.removeEventListener("popstate",e),window.removeEventListener(r,e)}},[]),o(()=>{typeof window>"u"||n.hash!==t.current&&(t.current=n.hash,window.dispatchEvent(new HashChangeEvent("hashchange")))},[n])}export{r as URL_REPLACE_EVENT,h as useRouterHashBridge};
@@ -1 +1 @@
1
- import{useEffect as i}from"react";import{useAtomValue as l,useSetAtom as m}from"jotai";import{useLocation as a}from"react-router-dom";import{IS_BROWSER as s,useActiveSectionId as f}from"@redocly/theme/core/openapi";import{activeScrollSectionAtom as u}from"../jotai/app.js";import{routingBasePathAtom as p}from"../jotai/store.js";import{encodeBackSlashes as S}from"../utils/string.js";import{normalizePath as d}from"../utils/url.js";import{useUserScrollIntent as h}from"./useUserScrollIntent.js";import{URL_REPLACE_EVENT as w}from"./useRouterHashBridge.js";function c(t){window.history.replaceState({},"",t),window.dispatchEvent(new Event(w))}function _(){const t=a(),e=m(u),r=l(p),o=f(t,!1,!1),n=h(t.key);i(()=>{e(null)},[t.pathname,e]),i(()=>{if(!(!s||!o)&&(e(o),!!n.current)){if(o===r){c(r);return}!window.location.pathname.includes(o)&&!window.location.hash.includes(o)&&c(d(S(o)))}},[o,r,e,n])}export{_ as useScrollSpyUrlSync};
1
+ import{useEffect as i}from"react";import{useAtomValue as l,useSetAtom as m}from"jotai";import{useLocation as a}from"react-router";import{IS_BROWSER as s,useActiveSectionId as f}from"@redocly/theme/core/openapi";import{activeScrollSectionAtom as u}from"../jotai/app.js";import{routingBasePathAtom as p}from"../jotai/store.js";import{encodeBackSlashes as S}from"../utils/string.js";import{normalizePath as d}from"../utils/url.js";import{useUserScrollIntent as h}from"./useUserScrollIntent.js";import{URL_REPLACE_EVENT as w}from"./useRouterHashBridge.js";function c(t){window.history.replaceState({},"",t),window.dispatchEvent(new Event(w))}function _(){const t=a(),e=m(u),r=l(p),o=f(t,!1,!1),n=h(t.key);i(()=>{e(null)},[t.pathname,e]),i(()=>{if(!(!s||!o)&&(e(o),!!n.current)){if(o===r){c(r);return}!window.location.pathname.includes(o)&&!window.location.hash.includes(o)&&c(d(S(o)))}},[o,r,e,n])}export{_ as useScrollSpyUrlSync};
@@ -1 +1 @@
1
- import{useEffect as s}from"react";import{useSetAtom as i}from"jotai";import{useLocation as a}from"react-router-dom";import{visitedChannelsAtom as m}from"../jotai/app.js";function p(){const o=a(),e=i(m);s(()=>{const n=o.pathname.toLowerCase();e(t=>t.includes(n)?t:[...t,n])},[o.pathname,e])}export{p as useVisitedChannelsTracker};
1
+ import{useEffect as s}from"react";import{useSetAtom as i}from"jotai";import{useLocation as a}from"react-router";import{visitedChannelsAtom as m}from"../jotai/app.js";function p(){const o=a(),e=i(m);s(()=>{const n=o.pathname.toLowerCase();e(t=>t.includes(n)?t:[...t,n])},[o.pathname,e])}export{p as useVisitedChannelsTracker};
@@ -49,9 +49,6 @@ export declare const allowedEnvironmentsAtom: import("jotai").WritableAtom<strin
49
49
  export declare const appSessionStore: import("jotai").WritableAtom<AppSessionStore, [typeof import("jotai/utils").RESET | AppSessionStore | ((prev: AppSessionStore) => typeof import("jotai/utils").RESET | AppSessionStore)], void>;
50
50
  export declare const collapsedSidebarAtom: import("jotai").WritableAtom<boolean, boolean[], void>;
51
51
  export declare const languageAtom: import("jotai").WritableAtom<LanguageAtom, [string], void>;
52
- export declare const selectedCallbackAtom: import("jotai").PrimitiveAtom<string | null> & {
53
- init: string | null;
54
- };
55
52
  export declare const selectedSecuritySchemeIdxAtom: import("jotai").PrimitiveAtom<number> & {
56
53
  init: number;
57
54
  };
package/lib/jotai/app.js CHANGED
@@ -1 +1 @@
1
- import{atom as r}from"jotai";import{atomWithStorage as v,createJSONStorage as A}from"jotai/utils";import{LayoutVariant as x}from"@redocly/config";import{getCookie as y,removeCookie as k,setCookie as C}from"../utils/cookies.js";import{mergeEnvData as l,IS_BROWSER as E}from"../utils/environments.js";import{keepReadingSectionAnchored as N}from"../utils/scroll-anchoring.js";import{safeJsonParse as g}from"../utils/string.js";import{fromSessionStorage as O,toSessionStorage as b}from"../utils/session-storage.js";import{DEFAULT_LAYOUT as V}from"../options/constants.js";import{globalOptionsAtom as I}from"./store.js";const d={activeMimeName:"",layout:V,language:"",environment:"",environments:{},userClaims:{},allowedEnvironments:null},L={getItem:e=>{const o=g(y(e,globalThis.redoclyCookieStorage?.getStore?.())),t=g(O(e));return{...d,...t,...o}},setItem:(e,o)=>{const{environments:t,...n}=o,a={environments:t};C(e,JSON.stringify(n)),b(e,JSON.stringify(a))},removeItem:e=>{k(e),sessionStorage.removeItem(e)}},s=v("redoc.appStore",d,L),U=r(e=>{const o=e(s);return l(o.environments,{})}),W=r(e=>{const o=e(s),t=l(o.environments,{}),n=o.environment,a=Object.keys(t).find(c=>t[c]?.server===n),i=t[n]?n:a??Object.keys(t)[0];let m=t[i]||{};return!m.server&&a&&(m={...t[a],...m}),[m,i||""]},(e,o,{environment:t,environments:n})=>{const a=e(s);o(s,{...a,environment:t||a.environment,environments:l(a.environments||{},n)})}),_=r(e=>e(s).environment),p=r(e=>e(s).activeMimeName,(e,o,t)=>{const n=e(s);o(s,{...n,activeMimeName:t})}),S=r(void 0),q=r(e=>e(S)??(e(p)||void 0),(e,o,t)=>{o(S,void 0),(t??"")!==e(p)&&N(),o(p,t??"")}),B=r(e=>e(s).layout,(e,o,t=x.STACKED)=>{const n=e(s);o(s,{...n,layout:t})}),P=r(e=>e(s).userClaims,(e,o,t)=>{const n=e(s);o(s,{...n,userClaims:t})}),Y=r(e=>e(s).allowedEnvironments,(e,o,t)=>{const n=e(s);o(s,{...n,allowedEnvironments:t})}),u=v("redoc.appSessionStore",{collapsedSidebar:!1,unsupportedFeatureScreen:!1},E?A(()=>sessionStorage):void 0),z=r(e=>e(u).collapsedSidebar,(e,o,t)=>{const n=e(u);o(u,{...n,collapsedSidebar:t})}),G=r(e=>{const o=e(I),{codeSamples:t}=o;if(!t?.languages)return{languages:[],activeLanguage:e(s).language||""};const n=t.languages.map(({key:i,label:m,lang:c},f)=>({key:i,lang:c,title:m,order:f})),a=e(s).language||n[0]?.key;return{languages:n,activeLanguage:n.find(({key:i})=>i===a)?.key||n[0]?.key}},(e,o,t)=>{const n=e(s);o(s,{...n,language:t})}),H=r(null),Q=r(0),X=r({}),Z=r(null),$=r([]);export{q as activeMediaTypeAtom,p as activeMimeNameAtom,Z as activeScrollSectionAtom,Y as allowedEnvironmentsAtom,u as appSessionStore,s as appStore,z as collapsedSidebarAtom,W as environmentAtom,U as environmentsAtom,G as languageAtom,B as layoutAtom,S as mediaTypeOverrideAtom,X as requestValuesAtom,_ as savedEnvironmentNameAtom,H as selectedCallbackAtom,Q as selectedSecuritySchemeIdxAtom,P as userClaimsAtom,$ as visitedChannelsAtom};
1
+ import{atom as r}from"jotai";import{atomWithStorage as v,createJSONStorage as A}from"jotai/utils";import{LayoutVariant as y}from"@redocly/config";import{getCookie as x,removeCookie as k,setCookie as C}from"../utils/cookies.js";import{mergeEnvData as l,IS_BROWSER as E}from"../utils/environments.js";import{keepReadingSectionAnchored as N}from"../utils/scroll-anchoring.js";import{safeJsonParse as g}from"../utils/string.js";import{fromSessionStorage as O,toSessionStorage as b}from"../utils/session-storage.js";import{DEFAULT_LAYOUT as V}from"../options/constants.js";import{globalOptionsAtom as I}from"./store.js";const d={activeMimeName:"",layout:V,language:"",environment:"",environments:{},userClaims:{},allowedEnvironments:null},L={getItem:e=>{const o=g(x(e,globalThis.redoclyCookieStorage?.getStore?.())),t=g(O(e));return{...d,...t,...o}},setItem:(e,o)=>{const{environments:t,...n}=o,a={environments:t};C(e,JSON.stringify(n)),b(e,JSON.stringify(a))},removeItem:e=>{k(e),sessionStorage.removeItem(e)}},s=v("redoc.appStore",d,L),U=r(e=>{const o=e(s);return l(o.environments,{})}),W=r(e=>{const o=e(s),t=l(o.environments,{}),n=o.environment,a=Object.keys(t).find(c=>t[c]?.server===n),i=t[n]?n:a??Object.keys(t)[0];let m=t[i]||{};return!m.server&&a&&(m={...t[a],...m}),[m,i||""]},(e,o,{environment:t,environments:n})=>{const a=e(s);o(s,{...a,environment:t||a.environment,environments:l(a.environments||{},n)})}),_=r(e=>e(s).environment),p=r(e=>e(s).activeMimeName,(e,o,t)=>{const n=e(s);o(s,{...n,activeMimeName:t})}),S=r(void 0),q=r(e=>e(S)??(e(p)||void 0),(e,o,t)=>{o(S,void 0),(t??"")!==e(p)&&N(),o(p,t??"")}),B=r(e=>e(s).layout,(e,o,t=y.STACKED)=>{const n=e(s);o(s,{...n,layout:t})}),P=r(e=>e(s).userClaims,(e,o,t)=>{const n=e(s);o(s,{...n,userClaims:t})}),Y=r(e=>e(s).allowedEnvironments,(e,o,t)=>{const n=e(s);o(s,{...n,allowedEnvironments:t})}),u=v("redoc.appSessionStore",{collapsedSidebar:!1,unsupportedFeatureScreen:!1},E?A(()=>sessionStorage):void 0),z=r(e=>e(u).collapsedSidebar,(e,o,t)=>{const n=e(u);o(u,{...n,collapsedSidebar:t})}),G=r(e=>{const o=e(I),{codeSamples:t}=o;if(!t?.languages)return{languages:[],activeLanguage:e(s).language||""};const n=t.languages.map(({key:i,label:m,lang:c},f)=>({key:i,lang:c,title:m,order:f})),a=e(s).language||n[0]?.key;return{languages:n,activeLanguage:n.find(({key:i})=>i===a)?.key||n[0]?.key}},(e,o,t)=>{const n=e(s);o(s,{...n,language:t})}),H=r(0),Q=r({}),X=r(null),Z=r([]);export{q as activeMediaTypeAtom,p as activeMimeNameAtom,X as activeScrollSectionAtom,Y as allowedEnvironmentsAtom,u as appSessionStore,s as appStore,z as collapsedSidebarAtom,W as environmentAtom,U as environmentsAtom,G as languageAtom,B as layoutAtom,S as mediaTypeOverrideAtom,Q as requestValuesAtom,_ as savedEnvironmentNameAtom,H as selectedSecuritySchemeIdxAtom,P as userClaimsAtom,Z as visitedChannelsAtom};
@@ -4,6 +4,7 @@ export type ItemStore = {
4
4
  activeOneOf: Record<string, number>;
5
5
  activeResponseCode: string;
6
6
  activeMessageKey: string;
7
+ selectedCallback: string;
7
8
  expandableSections: Record<string, boolean | undefined>;
8
9
  collapsibles: Record<string, boolean>;
9
10
  };
@@ -1 +1 @@
1
- import{atom as p}from"jotai";import{selectAtom as m}from"jotai/utils";import{atomFamily as c}from"jotai-family";import{keepReadingSectionAnchored as O}from"../utils/scroll-anchoring.js";const d=Object.freeze({activeDiscriminator:Object.freeze({}),activeOneOf:Object.freeze({}),activeResponseCode:"",activeMessageKey:"",expandableSections:Object.freeze({}),collapsibles:Object.freeze({})});function u(){return d}const l=p({}),y=["activeResponseCode","activeMessageKey","activeOneOf","activeDiscriminator"],f=c(e=>p(t=>t(l)[e]??u(),(t,n,o)=>{const i=t(l),r=i[e]??u(),a=typeof o=="function"?o(r):o;y.some(s=>s in a&&a[s]!==r[s])&&O(),n(l,{...i,[e]:{...r,...a}})})),A=c(e=>m(f(e.itemId),t=>t[e.key]),(e,t)=>e.itemId===t.itemId&&e.key===t.key);function S(e){return A(e)}function j(e,t){const n=e?.length?e.join("/"):"";return n?`${n}/${t}`:t}function R(e){return S({itemId:e,key:"activeDiscriminator"})}function D(e){return S({itemId:e,key:"activeOneOf"})}const b=c(e=>m(f(e.itemId),t=>t.expandableSections[e.key]),(e,t)=>e.itemId===t.itemId&&e.key===t.key);function F(e,t){return b({itemId:e,key:t})}const x="#";function K(e,t){return`${e}${x}${t}`}function T(e){const t=e.indexOf(x);return t===-1?e:e.slice(0,t)}const v=c(e=>m(f(e),t=>Object.keys(t.expandableSections),(t,n)=>t.length===n.length&&t.every((o,i)=>o===n[i])));function _(e){return v(e)}export{R as activeDiscriminatorSelectAtom,D as activeOneOfSelectAtom,K as buildCollapsibleEntryKey,j as buildVariantStateKey,T as collapsibleEntrySection,F as expandableSectionAtom,_ as expandableSectionKeysAtom,f as itemStoreAtom,S as itemStoreFieldAtom};
1
+ import{atom as p}from"jotai";import{selectAtom as m}from"jotai/utils";import{atomFamily as c}from"jotai-family";import{keepReadingSectionAnchored as x}from"../utils/scroll-anchoring.js";const O=Object.freeze({activeDiscriminator:Object.freeze({}),activeOneOf:Object.freeze({}),activeResponseCode:"",activeMessageKey:"",selectedCallback:"",expandableSections:Object.freeze({}),collapsibles:Object.freeze({})});function u(){return O}const l=p({}),y=["activeResponseCode","activeMessageKey","activeOneOf","activeDiscriminator"],f=c(e=>p(t=>t(l)[e]??u(),(t,n,o)=>{const i=t(l),r=i[e]??u(),a=typeof o=="function"?o(r):o;y.some(s=>s in a&&a[s]!==r[s])&&x(),n(l,{...i,[e]:{...r,...a}})})),A=c(e=>m(f(e.itemId),t=>t[e.key]),(e,t)=>e.itemId===t.itemId&&e.key===t.key);function S(e){return A(e)}function j(e,t){const n=e?.length?e.join("/"):"";return n?`${n}/${t}`:t}function R(e){return S({itemId:e,key:"activeDiscriminator"})}function D(e){return S({itemId:e,key:"activeOneOf"})}const b=c(e=>m(f(e.itemId),t=>t.expandableSections[e.key]),(e,t)=>e.itemId===t.itemId&&e.key===t.key);function F(e,t){return b({itemId:e,key:t})}const d="#";function K(e,t){return`${e}${d}${t}`}function T(e){const t=e.indexOf(d);return t===-1?e:e.slice(0,t)}const v=c(e=>m(f(e),t=>Object.keys(t.expandableSections),(t,n)=>t.length===n.length&&t.every((o,i)=>o===n[i])));function _(e){return v(e)}export{R as activeDiscriminatorSelectAtom,D as activeOneOfSelectAtom,K as buildCollapsibleEntryKey,j as buildVariantStateKey,T as collapsibleEntrySection,F as expandableSectionAtom,_ as expandableSectionKeysAtom,f as itemStoreAtom,S as itemStoreFieldAtom};
@@ -1,4 +1,4 @@
1
- import{jsx as a,jsxs as L}from"react/jsx-runtime";import{memo as R,useEffect as b,useMemo as p}from"react";import{styled as A}from"styled-components";import{useAtomValue as u}from"jotai";import{useLocation as M}from"react-router-dom";import{LayoutVariant as S}from"@redocly/config";import{ThreePanelLayout as T}from"@redocly/theme/layouts/ThreePanelLayout";import{layoutAtom as C,collapsedSidebarAtom as O}from"../jotai/app.js";import{globalOptionsAtom as j}from"../jotai/store.js";import{contentType as x}from"../types/common.js";import{markSectionRendered as D}from"../components/common/LazySection.js";import{MiddlePanel as F}from"../components/common/ContentWrapper.js";import{NotFoundPage as I}from"./NotFoundPage.js";import{TopLevelEntryView as V}from"./TopLevelEntryView.js";import{buildTopLevelEntries as _,buildEagerSlugs as B,resolveRouteByPathname as K}from"../utils/routing.js";import{useApiDocsScroll as N}from"../hooks/useApiDocsScroll.js";import{useHashLinkRedirect as $}from"../hooks/useHashLinkRedirect.js";import{useIsHydrated as w}from"../hooks/useIsHydrated.js";import{RenderHook as v}from"../components/RenderHook.js";function G({routeIndex:o,basePath:m}){const f=u(C),P=u(O),g=M(),i=w(),{unstable_hooks:l}=u(j),n=p(()=>K(o,g.pathname),[o,g.pathname]),s=p(()=>_(o),[o]),c=p(()=>B(n,o),[n,o]);b(()=>{c.forEach(e=>D(e))},[c]),N({activeRoute:n,routeIndex:o,basePath:m,isHydrated:i});const k=$(m,o),t=n?.path,H=p(()=>{if(i||!t)return s;const e=s.findIndex(r=>r.sectionId===t||r.children.some(h=>h.path===t));return e>0?s.slice(e):s},[s,t,i]);return!n&&o.allRoutes.length>0?a(I,{routingBasePath:m}):L(T,{className:"api-content",id:"api-content",layout:f,collapsedSidebar:P,onClickCapture:k,children:[l?.MiddlePanelHeader&&a(E,{$isStacked:f===S.STACKED,"data-testid":"middle-panel-header",children:a(v,{Hook:l.MiddlePanelHeader,props:void 0})}),H.map(e=>{const r=e.children.findIndex(d=>d.path===t),h=!i&&r>0?r:0,y=i||r===-1;return a(V,{entry:e,activePath:t,entryEager:c.has(e.sectionId),eagerOpSlug:e.children.find(d=>c.has(d.path))?.path??null,opsStartIndex:h,renderEntrySection:y,shouldRenderOps:e.sectionId===t||e.children.some(d=>d.path===t)||e.children.length>0&&e.content.contentType!==x.GROUP},e.sectionId)}),l?.MiddlePanelFooter&&a(E,{$isStacked:f===S.STACKED,"data-testid":"middle-panel-footer",children:a(v,{Hook:l.MiddlePanelFooter,props:void 0})})]})}const ce=R(G),E=A(F)`
1
+ import{jsx as a,jsxs as L}from"react/jsx-runtime";import{memo as R,useEffect as b,useMemo as p}from"react";import{styled as A}from"styled-components";import{useAtomValue as u}from"jotai";import{useLocation as M}from"react-router";import{LayoutVariant as S}from"@redocly/config";import{ThreePanelLayout as T}from"@redocly/theme/layouts/ThreePanelLayout";import{layoutAtom as C,collapsedSidebarAtom as O}from"../jotai/app.js";import{globalOptionsAtom as j}from"../jotai/store.js";import{contentType as x}from"../types/common.js";import{markSectionRendered as D}from"../components/common/LazySection.js";import{MiddlePanel as F}from"../components/common/ContentWrapper.js";import{NotFoundPage as I}from"./NotFoundPage.js";import{TopLevelEntryView as V}from"./TopLevelEntryView.js";import{buildTopLevelEntries as _,buildEagerSlugs as B,resolveRouteByPathname as K}from"../utils/routing.js";import{useApiDocsScroll as N}from"../hooks/useApiDocsScroll.js";import{useHashLinkRedirect as $}from"../hooks/useHashLinkRedirect.js";import{useIsHydrated as w}from"../hooks/useIsHydrated.js";import{RenderHook as v}from"../components/RenderHook.js";function G({routeIndex:o,basePath:m}){const f=u(C),P=u(O),g=M(),i=w(),{unstable_hooks:l}=u(j),n=p(()=>K(o,g.pathname),[o,g.pathname]),s=p(()=>_(o),[o]),c=p(()=>B(n,o),[n,o]);b(()=>{c.forEach(e=>D(e))},[c]),N({activeRoute:n,routeIndex:o,basePath:m,isHydrated:i});const k=$(m,o),t=n?.path,H=p(()=>{if(i||!t)return s;const e=s.findIndex(r=>r.sectionId===t||r.children.some(h=>h.path===t));return e>0?s.slice(e):s},[s,t,i]);return!n&&o.allRoutes.length>0?a(I,{routingBasePath:m}):L(T,{className:"api-content",id:"api-content",layout:f,collapsedSidebar:P,onClickCapture:k,children:[l?.MiddlePanelHeader&&a(E,{$isStacked:f===S.STACKED,"data-testid":"middle-panel-header",children:a(v,{Hook:l.MiddlePanelHeader,props:void 0})}),H.map(e=>{const r=e.children.findIndex(d=>d.path===t),h=!i&&r>0?r:0,y=i||r===-1;return a(V,{entry:e,activePath:t,entryEager:c.has(e.sectionId),eagerOpSlug:e.children.find(d=>c.has(d.path))?.path??null,opsStartIndex:h,renderEntrySection:y,shouldRenderOps:e.sectionId===t||e.children.some(d=>d.path===t)||e.children.length>0&&e.content.contentType!==x.GROUP},e.sectionId)}),l?.MiddlePanelFooter&&a(E,{$isStacked:f===S.STACKED,"data-testid":"middle-panel-footer",children:a(v,{Hook:l.MiddlePanelFooter,props:void 0})})]})}const ce=R(G),E=A(F)`
2
2
  align-self: flex-start;
3
3
  padding-top: var(--panel-gap-vertical);
4
4
  padding-bottom: var(--panel-gap-vertical);
@@ -1,4 +1,4 @@
1
- import{jsx as l,jsxs as u}from"react/jsx-runtime";import{memo as S,useMemo as b}from"react";import{styled as c}from"styled-components";import{useNavigate as A}from"react-router-dom";import{useAtomValue as f}from"jotai";import{LayoutVariant as B}from"@redocly/config";import{Button as C}from"@redocly/theme/components/Button/Button";import{breakpoints as h}from"@redocly/theme/core/openapi";import{layoutAtom as T}from"../jotai/app.js";import{routingBasePathAtom as z}from"../jotai/store.js";import{toElementId as I}from"../utils/url.js";import{SECTION_ATTR as N}from"../constants/openapi.js";import{panelKind as j}from"../types/common.js";import{Breadcrumbs as G}from"../components/common/Breadcrumbs.js";import{ComponentMapper as M}from"../components/Mapper.js";import{useSpecTranslate as U}from"../hooks/useTranslate.js";import{useIsExpanded as _}from"../hooks/useIsExpanded.js";import{useNormalizeUrl as L,useNavigationUrlNormalizer as K}from"../hooks/useNormalizeUrl.js";import{compose as O}from"../utils/compose.js";import{withItemId as R}from"../hoc/withItemId.js";function V(r,o){const a=o.split("/").filter(Boolean),n=r.length,e=a.slice(0,a.length-n);return r.map((s,i)=>({label:s.label,link:"/"+[...e,...a.slice(e.length,e.length+i)].join("/")}))}function q(r){for(const o of r?.children??[]){const a=o?.panels;if(Array.isArray(a)&&a.some(n=>n?.children?.some(e=>e?.kind===j.GROUP_ITEMS)))return!0}return!1}function D({content:r,itemPath:o,sectionId:a}){const{meta:n,children:e}=r||{},s=U(),i=A(),d=_(o),v=L(o),p=K(),x=f(T)===B.STACKED,g=b(()=>q(r),[r]),m=b(()=>n?.breadcrumbs?V(n.breadcrumbs,o).map(t=>({name:t.label,href:p(t.link)})):void 0,[n?.breadcrumbs,o,p]),w=s("actions.show","Show"),y=f(z),k=a?{[N]:a}:{},$=o?I(o,y):void 0;return u(P,{id:$,...k,$isExpanded:d,$isExpandable:g,children:[m&&m.length>0&&l(F,{$isStacked:x,children:l(G,{breadcrumbs:m,onClick:i})}),e.map((t,E)=>l(M,{type:t.nodeType,node:t,itemPath:o},`${o}-${t.nodeType}-${E}`)),!d&&g&&u(W,{type:"button",variant:"text",size:"medium",onClick:()=>i(v),children:["+ ",w]})]})}const bo=O(R,S)(D),P=c.div`
1
+ import{jsx as l,jsxs as u}from"react/jsx-runtime";import{memo as S,useMemo as b}from"react";import{styled as c}from"styled-components";import{useNavigate as A}from"react-router";import{useAtomValue as f}from"jotai";import{LayoutVariant as B}from"@redocly/config";import{Button as C}from"@redocly/theme/components/Button/Button";import{breakpoints as h}from"@redocly/theme/core/openapi";import{layoutAtom as T}from"../jotai/app.js";import{routingBasePathAtom as z}from"../jotai/store.js";import{toElementId as I}from"../utils/url.js";import{SECTION_ATTR as N}from"../constants/openapi.js";import{panelKind as j}from"../types/common.js";import{Breadcrumbs as G}from"../components/common/Breadcrumbs.js";import{ComponentMapper as M}from"../components/Mapper.js";import{useSpecTranslate as U}from"../hooks/useTranslate.js";import{useIsExpanded as _}from"../hooks/useIsExpanded.js";import{useNormalizeUrl as L,useNavigationUrlNormalizer as K}from"../hooks/useNormalizeUrl.js";import{compose as O}from"../utils/compose.js";import{withItemId as R}from"../hoc/withItemId.js";function V(r,o){const a=o.split("/").filter(Boolean),n=r.length,e=a.slice(0,a.length-n);return r.map((s,i)=>({label:s.label,link:"/"+[...e,...a.slice(e.length,e.length+i)].join("/")}))}function q(r){for(const o of r?.children??[]){const a=o?.panels;if(Array.isArray(a)&&a.some(n=>n?.children?.some(e=>e?.kind===j.GROUP_ITEMS)))return!0}return!1}function D({content:r,itemPath:o,sectionId:a}){const{meta:n,children:e}=r||{},s=U(),i=A(),d=_(o),v=L(o),p=K(),x=f(T)===B.STACKED,g=b(()=>q(r),[r]),m=b(()=>n?.breadcrumbs?V(n.breadcrumbs,o).map(t=>({name:t.label,href:p(t.link)})):void 0,[n?.breadcrumbs,o,p]),w=s("actions.show","Show"),y=f(z),k=a?{[N]:a}:{},$=o?I(o,y):void 0;return u(P,{id:$,...k,$isExpanded:d,$isExpandable:g,children:[m&&m.length>0&&l(F,{$isStacked:x,children:l(G,{breadcrumbs:m,onClick:i})}),e.map((t,E)=>l(M,{type:t.nodeType,node:t,itemPath:o},`${o}-${t.nodeType}-${E}`)),!d&&g&&u(W,{type:"button",variant:"text",size:"medium",onClick:()=>i(v),children:["+ ",w]})]})}const bo=O(R,S)(D),P=c.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Link as c,useLocation as i}from"react-router-dom";import{useNormalizeUrl as d}from"../hooks/useNormalizeUrl.js";function m({routingBasePath:n}){const t=i(),a=d(n||"/");return e("div",{className:"not-found-page",children:o("div",{className:"not-found-content",children:[e("h1",{children:"404"}),e("h2",{children:"Page Not Found"}),o("p",{children:["The page ",e("code",{children:t.pathname})," could not be found."]}),e("p",{children:"This documentation page doesn't exist. It may have been moved or deleted."}),e(c,{to:a,className:"back-link",children:"\u2190 Back to API Documentation"})]})})}export{m as NotFoundPage};
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Link as c,useLocation as i}from"react-router";import{useNormalizeUrl as d}from"../hooks/useNormalizeUrl.js";function m({routingBasePath:n}){const t=i(),a=d(n||"/");return e("div",{className:"not-found-page",children:o("div",{className:"not-found-content",children:[e("h1",{children:"404"}),e("h2",{children:"Page Not Found"}),o("p",{children:["The page ",e("code",{children:t.pathname})," could not be found."]}),e("p",{children:"This documentation page doesn't exist. It may have been moved or deleted."}),e(c,{to:a,className:"back-link",children:"\u2190 Back to API Documentation"})]})})}export{m as NotFoundPage};
@@ -136,6 +136,28 @@ export declare function variantMarkersOnly(fieldParentsName: string[] | undefine
136
136
  * The search is case-insensitive and values are returned lowercased.
137
137
  */
138
138
  export declare function extractDeepLinkParamFromHash(hash: string, key: 'c' | 'm'): string | undefined;
139
+ /** Section name owning a callback's suffixes: `callbacks/<callbackId>[/…]`. */
140
+ export declare const CALLBACKS_SECTION = "callbacks";
141
+ /** Sub-section anchors a callback owns. Emitted by `CallbacksSection` and matched here, so
142
+ * the spelling is a contract — legacy openapi-docs links use these exact names. */
143
+ export declare const CALLBACK_REQUEST_SECTION = "callback-request";
144
+ export declare const CALLBACK_RESPONSE_SECTION = "callback-response";
145
+ export declare function stripCallbacksSegment(id: string): string;
146
+ /** Whether a hash id addresses the given item at all — it, or anything beneath it. */
147
+ export declare function hashIsForItem(hashId: string, itemId: string): boolean;
148
+ /** `itemId` must be in hash shape (basePath-free, lowercased); two operations can hold a
149
+ * callback with the same id, so the item has to match before the callback does. Any missing
150
+ * argument answers `false`, so callers needn't pre-check. */
151
+ export declare function hashTargetsCallback(hash: string, itemId: string, callbackId: string | undefined): boolean;
152
+ /** Whether a hash id addresses something inside the given callback.
153
+ * `hashId` and `itemId` are expected lowercased, as `hashToElementId` returns them. */
154
+ export declare function hashIsInsideCallback(hashId: string, itemId: string, callbackId: string): boolean;
155
+ /**
156
+ * Whether a hash id addresses the operation level, outside every callback. Only the part of
157
+ * the hash *after* the item id is examined, so an operation or tag whose own slug contains a
158
+ * marker (`/callback-response`) can't be mistaken for one either.
159
+ */
160
+ export declare function hashIsOutsideCallbacks(hashId: string, itemId: string): boolean;
139
161
  /**
140
162
  * Detect legacy openapi hash patterns and return normalized suffix.
141
163
  * Matches: #tag/..., #operation/..., #paths/...
@@ -1 +1 @@
1
- import{encodeBackSlashes as l,tryDecodeURIComponent as o}from"./string.js";import{joinWithSeparator as c,normalizePath as s}from"./url.js";import{resolveRouteByPathname as d}from"./routing.js";function a(e){const t=[];for(const[n,r]of Object.entries(e))r!==void 0&&t.push(`${n}=${r}`);return t.join("&")}function x(e,t){return e=l(e).replace(/^\/+/,""),(`/${e}#`+c(e,t)).toLowerCase()}function $(e,t,n){const r=x(t,n);return s(c(e,r))}function m(e){const t=e.startsWith("#")?e.slice(1):e;return o(t).toLowerCase()}function L(e){const t=o(e),n=t.indexOf("#");return n>=0?t.slice(n+1):""}function A(e){return a({t:e.t,in:e.in,c:e.c,cb:e.cb,ct:e.ct,path:e.path})}function R(e,t,n){let r=e;return n&&(r=`${r}&c=${n}`),t&&(r=c(r,t)),r}function b(e){const{section:t,messageKey:n,subsection:r}=e;if(!n)return t;let i=`${t}&m=${n}`;return r&&(i+=`&t=${r}`),i}function C(e){return a({t:e.t,path:e.path,arg:e.arg,rt:e.rt})}function S(e,t){return!e||!t?!1:o(e.startsWith("#")?e.slice(1):e).toLowerCase().includes(`path=${t.toLowerCase()}.`)}function D(e){return e&&L(e)||void 0}function O(e,t){const n=[...e??[]];return n.length>0?n[n.length-1]+=t:n.push(t),n}const g=/&(?:oneof|d)=\d+/g;function W(e){return e.replace(g,"")}function v(e){return e.replace(/\[\]/g,"")}function z(e){return(e??[]).filter(t=>t.includes("&")).map(t=>t.slice(t.indexOf("&")))}function E(e,t){return e?o(e.startsWith("#")?e.slice(1):e).toLowerCase().match(new RegExp(`(?:^|[&/])${t}=([^/&]+)`))?.[1]:void 0}function h(e){const t=["#tag","#operation","#paths"];for(const n of t)if(e.includes(n))return e.replace(n,"").toLowerCase();return""}function H(e,t,n){const r=m(e);if(!r)return;const i=s(c(t,r));if(d(n,i))return i;const u=h(e);if(u){const f=n.allRoutes.find(p=>p.path.toLowerCase().endsWith(u));if(f)return f.path}}export{O as appendVariantSuffix,b as buildAsyncApiSuffix,$ as buildDeepLinkUrl,C as buildGraphqlSuffix,A as buildOpenApiFieldSuffix,R as buildOpenApiSectionSuffix,L as deepLinkToId,E as extractDeepLinkParamFromHash,D as getDeepLinkId,h as getLegacyHash,m as hashToElementId,S as isGraphqlDeepLinkAncestor,x as makeDeepLink,H as resolveLegacyHashToRoute,a as serializeFieldParams,v as stripArrayMarkers,W as stripVariantMarkers,z as variantMarkersOnly};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/api-docs",
3
- "version": "0.1.0-next.2",
3
+ "version": "0.1.0-next.4",
4
4
  "description": "Redocly API Documentation Library",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -24,13 +24,13 @@
24
24
  "package.json"
25
25
  ],
26
26
  "peerDependencies": {
27
- "react": "^19.2.4",
28
- "react-dom": "^19.2.4",
27
+ "react": "^19.2.7",
28
+ "react-dom": "^19.2.7",
29
29
  "styled-components": "^6.4.2"
30
30
  },
31
31
  "dependencies": {
32
32
  "@markdoc/markdoc": "0.5.2",
33
- "@redocly/openapi-core": "2.44.2",
33
+ "@redocly/openapi-core": "2.45.0",
34
34
  "dompurify": "3.4.12",
35
35
  "fast-xml-parser": "5.7.3",
36
36
  "graphql": "16.12.0",
@@ -41,15 +41,15 @@
41
41
  "linkedom": "^0.18.12",
42
42
  "openapi-sampler": "^1.7.2",
43
43
  "prismjs": "1.30.0",
44
- "react-router-dom": "^7.18.1",
44
+ "react-router": "^8.3.0",
45
45
  "slugify": "^1.4.7",
46
46
  "swagger2openapi": "^7.0.8",
47
47
  "url-template": "^2.0.8",
48
48
  "web-vitals": "3.3.1",
49
49
  "@redocly/config": "0.53.1",
50
50
  "@redocly/redoc-opentelemetry": "0.2.2",
51
- "@redocly/replay": "0.27.0-next.8",
52
- "@redocly/theme": "^0.68.0-next.6",
51
+ "@redocly/replay": "0.27.0-next.9",
52
+ "@redocly/theme": "^0.68.0-next.7",
53
53
  "@redocly/allof-merge": "0.6.9"
54
54
  },
55
55
  "devDependencies": {
@@ -68,8 +68,8 @@
68
68
  "esbuild": "0.28.1",
69
69
  "globals": "^16.5.0",
70
70
  "jest-styled-components": "7.2.0",
71
- "react": "^19.2.4",
72
- "react-dom": "^19.2.4",
71
+ "react": "^19.2.7",
72
+ "react-dom": "^19.2.7",
73
73
  "rimraf": "5.0.7",
74
74
  "rollup-plugin-bundle-stats": "^4.22.1",
75
75
  "tsx": "^4.20.6",