This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
export declare const AnnouncementBarDismissStorageKey = "docusaurus.announcement.dismiss";
type ContextValue = {
/** Whether the announcement bar should be displayed. */
readonly isActive: boolean;
/**
* Callback fired when the user closes the announcement. Will be saved.
*/
readonly close: () => void;
};
export declare function AnnouncementBarProvider({ children, }: {
children: ReactNode;
}): JSX.Element;
export declare function useAnnouncementBar(): ContextValue;
export {};
//# sourceMappingURL=announcementBar.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"announcementBar.d.ts","sourceRoot":"","sources":["../../src/contexts/announcementBar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAMZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,eAAO,MAAM,gCAAgC,oCACV,CAAC;AAapC,KAAK,YAAY,GAAG;IAClB,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AA8DF,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAGd;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAMjD"}

View File

@@ -0,0 +1,72 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useState, useEffect, useCallback, useMemo, useContext, } from 'react';
import useIsBrowser from '@docusaurus/useIsBrowser';
import { createStorageSlot } from '../utils/storageUtils';
import { ReactContextError } from '../utils/reactUtils';
import { useThemeConfig } from '../utils/useThemeConfig';
export const AnnouncementBarDismissStorageKey = 'docusaurus.announcement.dismiss';
const AnnouncementBarIdStorageKey = 'docusaurus.announcement.id';
const AnnouncementBarDismissStorage = createStorageSlot(AnnouncementBarDismissStorageKey);
const IdStorage = createStorageSlot(AnnouncementBarIdStorageKey);
const isDismissedInStorage = () => AnnouncementBarDismissStorage.get() === 'true';
const setDismissedInStorage = (bool) => AnnouncementBarDismissStorage.set(String(bool));
const Context = React.createContext(null);
function useContextValue() {
const { announcementBar } = useThemeConfig();
const isBrowser = useIsBrowser();
const [isClosed, setClosed] = useState(() => isBrowser
? // On client navigation: init with local storage value
isDismissedInStorage()
: // On server/hydration: always visible to prevent layout shifts (will be hidden with css if needed)
false);
// Update state after hydration
useEffect(() => {
setClosed(isDismissedInStorage());
}, []);
const handleClose = useCallback(() => {
setDismissedInStorage(true);
setClosed(true);
}, []);
useEffect(() => {
if (!announcementBar) {
return;
}
const { id } = announcementBar;
let viewedId = IdStorage.get();
// Retrocompatibility due to spelling mistake of default id
// see https://github.com/facebook/docusaurus/issues/3338
// cSpell:ignore annoucement
if (viewedId === 'annoucement-bar') {
viewedId = 'announcement-bar';
}
const isNewAnnouncement = id !== viewedId;
IdStorage.set(id);
if (isNewAnnouncement) {
setDismissedInStorage(false);
}
if (isNewAnnouncement || !isDismissedInStorage()) {
setClosed(false);
}
}, [announcementBar]);
return useMemo(() => ({
isActive: !!announcementBar && !isClosed,
close: handleClose,
}), [announcementBar, isClosed, handleClose]);
}
export function AnnouncementBarProvider({ children, }) {
const value = useContextValue();
return <Context.Provider value={value}>{children}</Context.Provider>;
}
export function useAnnouncementBar() {
const api = useContext(Context);
if (!api) {
throw new ReactContextError('AnnouncementBarProvider');
}
return api;
}
//# sourceMappingURL=announcementBar.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"announcementBar.js","sourceRoot":"","sources":["../../src/contexts/announcementBar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KA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ChC,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,IAAI,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;KACxD;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}

View File

@@ -0,0 +1,33 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
import type { PropBlogPostContent } from '@docusaurus/plugin-content-blog';
/**
* The React context value returned by the `useBlogPost()` hook.
* It contains useful data related to the currently browsed blog post.
*/
export type BlogPostContextValue = Pick<PropBlogPostContent, 'metadata' | 'frontMatter' | 'assets' | 'toc'> & {
readonly isBlogPostPage: boolean;
};
/**
* This is a very thin layer around the `content` received from the MDX loader.
* It provides metadata about the blog post to the children tree.
*/
export declare function BlogPostProvider({ children, content, isBlogPostPage, }: {
children: ReactNode;
content: PropBlogPostContent;
isBlogPostPage?: boolean;
}): JSX.Element;
/**
* Returns the data of the currently browsed blog post. Gives access to
* front matter, metadata, TOC, etc.
* When swizzling a low-level component (e.g. the "Edit this page" link)
* and you need some extra metadata, you don't have to drill the props
* all the way through the component tree: simply use this hook instead.
*/
export declare function useBlogPost(): BlogPostContextValue;
//# sourceMappingURL=blogPost.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blogPost.d.ts","sourceRoot":"","sources":["../../src/contexts/blogPost.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAU,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAGjE,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,mBAAmB,EACnB,UAAU,GAAG,aAAa,GAAG,QAAQ,GAAG,KAAK,CAC9C,GAAG;IACF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC,CAAC;AA4BF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,cAAsB,GACvB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,GAAG,CAAC,OAAO,CAGd;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,oBAAoB,CAMlD"}

View File

@@ -0,0 +1,46 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useMemo, useContext } from 'react';
import { ReactContextError } from '../utils/reactUtils';
const Context = React.createContext(null);
/**
* Note: we don't use `PropBlogPostContent` as context value on purpose.
* Metadata is currently stored inside the MDX component, but we may want to
* change that in the future.
*/
function useContextValue({ content, isBlogPostPage, }) {
return useMemo(() => ({
metadata: content.metadata,
frontMatter: content.frontMatter,
assets: content.assets,
toc: content.toc,
isBlogPostPage,
}), [content, isBlogPostPage]);
}
/**
* This is a very thin layer around the `content` received from the MDX loader.
* It provides metadata about the blog post to the children tree.
*/
export function BlogPostProvider({ children, content, isBlogPostPage = false, }) {
const contextValue = useContextValue({ content, isBlogPostPage });
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
}
/**
* Returns the data of the currently browsed blog post. Gives access to
* front matter, metadata, TOC, etc.
* When swizzling a low-level component (e.g. the "Edit this page" link)
* and you need some extra metadata, you don't have to drill the props
* all the way through the component tree: simply use this hook instead.
*/
export function useBlogPost() {
const blogPost = useContext(Context);
if (blogPost === null) {
throw new ReactContextError('BlogPostProvider');
}
return blogPost;
}
//# sourceMappingURL=blogPost.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blogPost.js","sourceRoot":"","sources":["../../src/contexts/blogPost.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAkB,UAAU,EAAC,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAetD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAA8B,IAAI,CAAC,CAAC;AAEvE;;;;GAIG;AACH,SAAS,eAAe,CAAC,EACvB,OAAO,EACP,cAAc,GAIf;IACC,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,cAAc;KACf,CAAC,EACF,CAAC,OAAO,EAAE,cAAc,CAAC,CAC1B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,cAAc,GAAG,KAAK,GAKvB;IACC,MAAM,YAAY,GAAG,eAAe,CAAC,EAAC,OAAO,EAAE,cAAc,EAAC,CAAC,CAAC;IAChE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,QAAQ,KAAK,IAAI,EAAE;QACrB,MAAM,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;KACjD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}

View File

@@ -0,0 +1,27 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
type ContextValue = {
/** Current color mode. */
readonly colorMode: ColorMode;
/** Set new color mode. */
readonly setColorMode: (colorMode: ColorMode) => void;
readonly isDarkTheme: boolean;
readonly setLightTheme: () => void;
readonly setDarkTheme: () => void;
};
declare const ColorModes: {
readonly light: "light";
readonly dark: "dark";
};
export type ColorMode = (typeof ColorModes)[keyof typeof ColorModes];
export declare function ColorModeProvider({ children, }: {
children: ReactNode;
}): JSX.Element;
export declare function useColorMode(): ContextValue;
export {};
//# sourceMappingURL=colorMode.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"colorMode.d.ts","sourceRoot":"","sources":["../../src/contexts/colorMode.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,KAAK,YAAY,GAAG;IAClB,0BAA0B;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,0BAA0B;IAC1B,QAAQ,CAAC,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAGtD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC;CACnC,CAAC;AAOF,QAAA,MAAM,UAAU;;;CAGN,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAwIrE,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAGd;AAED,wBAAgB,YAAY,IAAI,YAAY,CAS3C"}

View File

@@ -0,0 +1,132 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useState, useCallback, useEffect, useContext, useMemo, useRef, } from 'react';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
import { ReactContextError } from '../utils/reactUtils';
import { createStorageSlot } from '../utils/storageUtils';
import { useThemeConfig } from '../utils/useThemeConfig';
const Context = React.createContext(undefined);
const ColorModeStorageKey = 'theme';
const ColorModeStorage = createStorageSlot(ColorModeStorageKey);
const ColorModes = {
light: 'light',
dark: 'dark',
};
// Ensure to always return a valid colorMode even if input is invalid
const coerceToColorMode = (colorMode) => colorMode === ColorModes.dark ? ColorModes.dark : ColorModes.light;
const getInitialColorMode = (defaultMode) => ExecutionEnvironment.canUseDOM
? coerceToColorMode(document.documentElement.getAttribute('data-theme'))
: coerceToColorMode(defaultMode);
const storeColorMode = (newColorMode) => {
ColorModeStorage.set(coerceToColorMode(newColorMode));
};
function useContextValue() {
const { colorMode: { defaultMode, disableSwitch, respectPrefersColorScheme }, } = useThemeConfig();
const [colorMode, setColorModeState] = useState(getInitialColorMode(defaultMode));
useEffect(() => {
// A site is deployed without disableSwitch
// => User visits the site and has a persisted value
// => Site later enabled disableSwitch
// => Clear the previously stored value to apply the site's setting
if (disableSwitch) {
ColorModeStorage.del();
}
}, [disableSwitch]);
const setColorMode = useCallback((newColorMode, options = {}) => {
const { persist = true } = options;
if (newColorMode) {
setColorModeState(newColorMode);
if (persist) {
storeColorMode(newColorMode);
}
}
else {
if (respectPrefersColorScheme) {
setColorModeState(window.matchMedia('(prefers-color-scheme: dark)').matches
? ColorModes.dark
: ColorModes.light);
}
else {
setColorModeState(defaultMode);
}
ColorModeStorage.del();
}
}, [respectPrefersColorScheme, defaultMode]);
useEffect(() => {
document.documentElement.setAttribute('data-theme', coerceToColorMode(colorMode));
}, [colorMode]);
useEffect(() => {
if (disableSwitch) {
return undefined;
}
const onChange = (e) => {
if (e.key !== ColorModeStorageKey) {
return;
}
const storedColorMode = ColorModeStorage.get();
if (storedColorMode !== null) {
setColorMode(coerceToColorMode(storedColorMode));
}
};
window.addEventListener('storage', onChange);
return () => window.removeEventListener('storage', onChange);
}, [disableSwitch, setColorMode]);
// PCS is coerced to light mode when printing, which causes the color mode to
// be reset to dark when exiting print mode, disregarding user settings. When
// the listener fires only because of a print/screen switch, we don't change
// color mode. See https://github.com/facebook/docusaurus/pull/6490
const previousMediaIsPrint = useRef(false);
useEffect(() => {
if (disableSwitch && !respectPrefersColorScheme) {
return undefined;
}
const mql = window.matchMedia('(prefers-color-scheme: dark)');
const onChange = () => {
if (window.matchMedia('print').matches || previousMediaIsPrint.current) {
previousMediaIsPrint.current = window.matchMedia('print').matches;
return;
}
setColorMode(null);
};
mql.addListener(onChange);
return () => mql.removeListener(onChange);
}, [setColorMode, disableSwitch, respectPrefersColorScheme]);
return useMemo(() => ({
colorMode,
setColorMode,
get isDarkTheme() {
if (process.env.NODE_ENV === 'development') {
console.error('`useColorMode().isDarkTheme` is deprecated. Please use `useColorMode().colorMode === "dark"` instead.');
}
return colorMode === ColorModes.dark;
},
setLightTheme() {
if (process.env.NODE_ENV === 'development') {
console.error('`useColorMode().setLightTheme` is deprecated. Please use `useColorMode().setColorMode("light")` instead.');
}
setColorMode(ColorModes.light);
},
setDarkTheme() {
if (process.env.NODE_ENV === 'development') {
console.error('`useColorMode().setDarkTheme` is deprecated. Please use `useColorMode().setColorMode("dark")` instead.');
}
setColorMode(ColorModes.dark);
},
}), [colorMode, setColorMode]);
}
export function ColorModeProvider({ children, }) {
const value = useContextValue();
return <Context.Provider value={value}>{children}</Context.Provider>;
}
export function useColorMode() {
const context = useContext(Context);
if (context == null) {
throw new ReactContextError('ColorModeProvider', 'Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.');
}
return context;
}
//# sourceMappingURL=colorMode.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"colorMode.js","sourceRoot":"","sources":["../../src/contexts/colorMode.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,OAAO,EACP,MAAM,GAEP,MAAM,OAAO,CAAC;AACf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AG,CAAC,QAAQ,KAAK,aAAa,EAAE;gBAC1C,OAAO,CAAC,KAAK,CACX,uGAAuG,CACxG,CAAC;aACH;YACD,OAAO,SAAS,KAAK,UAAU,CAAC,IAAI,CAAC;QACvC,CAAC;QACD,aAAa;YACX,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;gBAC1C,OAAO,CAAC,KAAK,CACX,0GAA0G,CAC3G,CAAC;aACH;YACD,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;QACD,YAAY;YACV,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;gBAC1C,OAAO,CAAC,KAAK,CACX,wGAAwG,CACzG,CAAC;aACH;YACD,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KACF,CAAC,EACF,CAAC,SAAS,EAAE,YAAY,CAAC,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAChC,QAAQ,GAGT;IACC,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAChC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,MAAM,IAAI,iBAAiB,CACzB,mBAAmB,EACnB,gFAAgF,CACjF,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}

View File

@@ -0,0 +1,30 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
import type { PropDocContent } from '@docusaurus/plugin-content-docs';
/**
* The React context value returned by the `useDoc()` hook.
* It contains useful data related to the currently browsed doc.
*/
export type DocContextValue = Pick<PropDocContent, 'metadata' | 'frontMatter' | 'toc' | 'assets' | 'contentTitle'>;
/**
* This is a very thin layer around the `content` received from the MDX loader.
* It provides metadata about the doc to the children tree.
*/
export declare function DocProvider({ children, content, }: {
children: ReactNode;
content: PropDocContent;
}): JSX.Element;
/**
* Returns the data of the currently browsed doc. Gives access to the doc's MDX
* Component, front matter, metadata, TOC, etc. When swizzling a low-level
* component (e.g. the "Edit this page" link) and you need some extra metadata,
* you don't have to drill the props all the way through the component tree:
* simply use this hook instead.
*/
export declare function useDoc(): DocContextValue;
//# sourceMappingURL=doc.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"doc.d.ts","sourceRoot":"","sources":["../../src/contexts/doc.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAU,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAC;AAEpE;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,cAAc,EACd,UAAU,GAAG,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,cAAc,CAC/D,CAAC;AAwBF;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,cAAc,CAAC;CACzB,GAAG,GAAG,CAAC,OAAO,CAGd;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,IAAI,eAAe,CAMxC"}

View File

@@ -0,0 +1,48 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useMemo, useContext } from 'react';
import { ReactContextError } from '../utils/reactUtils';
const Context = React.createContext(null);
/**
* Note: we don't use `PropDoc` as context value on purpose. Metadata is
* currently stored inside the MDX component, but we may want to change that in
* the future. This layer is a good opportunity to decouple storage from
* consuming API, potentially allowing us to provide metadata as both props and
* route context without duplicating the chunks in the future.
*/
function useContextValue(content) {
return useMemo(() => ({
metadata: content.metadata,
frontMatter: content.frontMatter,
assets: content.assets,
contentTitle: content.contentTitle,
toc: content.toc,
}), [content]);
}
/**
* This is a very thin layer around the `content` received from the MDX loader.
* It provides metadata about the doc to the children tree.
*/
export function DocProvider({ children, content, }) {
const contextValue = useContextValue(content);
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
}
/**
* Returns the data of the currently browsed doc. Gives access to the doc's MDX
* Component, front matter, metadata, TOC, etc. When swizzling a low-level
* component (e.g. the "Edit this page" link) and you need some extra metadata,
* you don't have to drill the props all the way through the component tree:
* simply use this hook instead.
*/
export function useDoc() {
const doc = useContext(Context);
if (doc === null) {
throw new ReactContextError('DocProvider');
}
return doc;
}
//# sourceMappingURL=doc.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"doc.js","sourceRoot":"","sources":["../../src/contexts/doc.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAkB,UAAU,EAAC,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAYtD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAyB,IAAI,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,OAAuB;IAC9C,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,EACF,CAAC,OAAO,CAAC,CACV,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,QAAQ,EACR,OAAO,GAIR;IACC,MAAM,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM;IACpB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,GAAG,KAAK,IAAI,EAAE;QAChB,MAAM,IAAI,iBAAiB,CAAC,aAAa,CAAC,CAAC;KAC5C;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}

View File

@@ -0,0 +1,31 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
type ContextValue = {
/**
* The item that the user last opened, `null` when there's none open. On
* initial render, it will always be `null`, which doesn't necessarily mean
* there's no category open (can have 0, 1, or many being initially open).
*/
expandedItem: number | null;
/**
* Set the currently expanded item, when the user opens one. Set the value to
* `null` when the user closes an open category.
*/
setExpandedItem: (a: number | null) => void;
};
/**
* Should be used to wrap one sidebar category level. This provider syncs the
* expanded states of all sibling categories, and categories can choose to
* collapse itself if another one is expanded.
*/
export declare function DocSidebarItemsExpandedStateProvider({ children, }: {
children: ReactNode;
}): JSX.Element;
export declare function useDocSidebarItemsExpandedState(): ContextValue;
export {};
//# sourceMappingURL=docSidebarItemsExpandedState.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"docSidebarItemsExpandedState.d.ts","sourceRoot":"","sources":["../../src/contexts/docSidebarItemsExpandedState.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAC,KAAK,SAAS,EAAgC,MAAM,OAAO,CAAC;AAG3E,KAAK,YAAY,GAAG;IAClB;;;;OAIG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;OAGG;IACH,eAAe,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC7C,CAAC;AAOF;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAC,EACnD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAQd;AAED,wBAAgB,+BAA+B,IAAI,YAAY,CAM9D"}

View File

@@ -0,0 +1,28 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useMemo, useState, useContext } from 'react';
import { ReactContextError } from '../utils/reactUtils';
const EmptyContext = Symbol('EmptyContext');
const Context = React.createContext(EmptyContext);
/**
* Should be used to wrap one sidebar category level. This provider syncs the
* expanded states of all sibling categories, and categories can choose to
* collapse itself if another one is expanded.
*/
export function DocSidebarItemsExpandedStateProvider({ children, }) {
const [expandedItem, setExpandedItem] = useState(null);
const contextValue = useMemo(() => ({ expandedItem, setExpandedItem }), [expandedItem]);
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
}
export function useDocSidebarItemsExpandedState() {
const value = useContext(Context);
if (value === EmptyContext) {
throw new ReactContextError('DocSidebarItemsExpandedStateProvider');
}
return value;
}
//# sourceMappingURL=docSidebarItemsExpandedState.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"docSidebarItemsExpandedState.js","sourceRoot":"","sources":["../../src/contexts/docSidebarItemsExpandedState.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAiB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAgBtD,MAAM,YAAY,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAC3D,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CACjC,YAAY,CACb,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,oCAAoC,CAAC,EACnD,QAAQ,GAGT;IACC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC,EAAC,YAAY,EAAE,eAAe,EAAC,CAAC,EACvC,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,KAAK,KAAK,YAAY,EAAE;QAC1B,MAAM,IAAI,iBAAiB,CAAC,sCAAsC,CAAC,CAAC;KACrE;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}

View File

@@ -0,0 +1,30 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
import { type GlobalVersion } from '@docusaurus/plugin-content-docs/client';
/**
* This is a maybe-layer. If the docs plugin is not enabled, this provider is a
* simple pass-through.
*/
export declare function DocsPreferredVersionContextProvider({ children, }: {
children: ReactNode;
}): JSX.Element;
/**
* Returns a read-write interface to a plugin's preferred version. The
* "preferred version" is defined as the last version that the user visited.
* For example, if a user is using v3, even when v4 is later published, the user
* would still be browsing v3 docs when she opens the website next time. Note,
* the `preferredVersion` attribute will always be `null` before mount.
*/
export declare function useDocsPreferredVersion(pluginId?: string | undefined): {
preferredVersion: GlobalVersion | null;
savePreferredVersionName: (versionName: string) => void;
};
export declare function useDocsPreferredVersionByPluginId(): {
[pluginId: string]: GlobalVersion | null;
};
//# sourceMappingURL=docsPreferredVersion.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"docsPreferredVersion.d.ts","sourceRoot":"","sources":["../../src/contexts/docsPreferredVersion.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAMZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,wCAAwC,CAAC;AAsJhD;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,EAClD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CASd;AAUD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,GAAE,MAAM,GAAG,SAA6B,GAC/C;IACD,gBAAgB,EAAE,aAAa,GAAG,IAAI,CAAC;IACvC,wBAAwB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACzD,CAmBA;AAED,wBAAgB,iCAAiC,IAAI;IACnD,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAAC;CAC1C,CAkBA"}

View File

@@ -0,0 +1,130 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useContext, useEffect, useMemo, useState, useCallback, } from 'react';
import { useAllDocsData, useDocsData, } from '@docusaurus/plugin-content-docs/client';
import { DEFAULT_PLUGIN_ID } from '@docusaurus/constants';
import { useThemeConfig, } from '../utils/useThemeConfig';
import { isDocsPluginEnabled } from '../utils/docsUtils';
import { ReactContextError } from '../utils/reactUtils';
import { createStorageSlot } from '../utils/storageUtils';
const storageKey = (pluginId) => `docs-preferred-version-${pluginId}`;
const DocsPreferredVersionStorage = {
save: (pluginId, persistence, versionName) => {
createStorageSlot(storageKey(pluginId), { persistence }).set(versionName);
},
read: (pluginId, persistence) => createStorageSlot(storageKey(pluginId), { persistence }).get(),
clear: (pluginId, persistence) => {
createStorageSlot(storageKey(pluginId), { persistence }).del();
},
};
/**
* Initial state is always null as we can't read local storage from node SSR
*/
const getInitialState = (pluginIds) => Object.fromEntries(pluginIds.map((id) => [id, { preferredVersionName: null }]));
/**
* Read storage for all docs plugins, assigning each doc plugin a preferred
* version (if found)
*/
function readStorageState({ pluginIds, versionPersistence, allDocsData, }) {
/**
* The storage value we read might be stale, and belong to a version that does
* not exist in the site anymore. In such case, we remove the storage value to
* avoid downstream errors.
*/
function restorePluginState(pluginId) {
const preferredVersionNameUnsafe = DocsPreferredVersionStorage.read(pluginId, versionPersistence);
const pluginData = allDocsData[pluginId];
const versionExists = pluginData.versions.some((version) => version.name === preferredVersionNameUnsafe);
if (versionExists) {
return { preferredVersionName: preferredVersionNameUnsafe };
}
DocsPreferredVersionStorage.clear(pluginId, versionPersistence);
return { preferredVersionName: null };
}
return Object.fromEntries(pluginIds.map((id) => [id, restorePluginState(id)]));
}
function useVersionPersistence() {
return useThemeConfig().docs.versionPersistence;
}
const Context = React.createContext(null);
function useContextValue() {
const allDocsData = useAllDocsData();
const versionPersistence = useVersionPersistence();
const pluginIds = useMemo(() => Object.keys(allDocsData), [allDocsData]);
// Initial state is empty, as we can't read browser storage in node/SSR
const [state, setState] = useState(() => getInitialState(pluginIds));
// On mount, we set the state read from browser storage
useEffect(() => {
setState(readStorageState({ allDocsData, versionPersistence, pluginIds }));
}, [allDocsData, versionPersistence, pluginIds]);
// The API that we expose to consumer hooks (memo for constant object)
const api = useMemo(() => {
function savePreferredVersion(pluginId, versionName) {
DocsPreferredVersionStorage.save(pluginId, versionPersistence, versionName);
setState((s) => ({
...s,
[pluginId]: { preferredVersionName: versionName },
}));
}
return {
savePreferredVersion,
};
}, [versionPersistence]);
return [state, api];
}
function DocsPreferredVersionContextProviderUnsafe({ children, }) {
const value = useContextValue();
return <Context.Provider value={value}>{children}</Context.Provider>;
}
/**
* This is a maybe-layer. If the docs plugin is not enabled, this provider is a
* simple pass-through.
*/
export function DocsPreferredVersionContextProvider({ children, }) {
if (isDocsPluginEnabled) {
return (<DocsPreferredVersionContextProviderUnsafe>
{children}
</DocsPreferredVersionContextProviderUnsafe>);
}
return <>{children}</>;
}
function useDocsPreferredVersionContext() {
const value = useContext(Context);
if (!value) {
throw new ReactContextError('DocsPreferredVersionContextProvider');
}
return value;
}
/**
* Returns a read-write interface to a plugin's preferred version. The
* "preferred version" is defined as the last version that the user visited.
* For example, if a user is using v3, even when v4 is later published, the user
* would still be browsing v3 docs when she opens the website next time. Note,
* the `preferredVersion` attribute will always be `null` before mount.
*/
export function useDocsPreferredVersion(pluginId = DEFAULT_PLUGIN_ID) {
const docsData = useDocsData(pluginId);
const [state, api] = useDocsPreferredVersionContext();
const { preferredVersionName } = state[pluginId];
const preferredVersion = docsData.versions.find((version) => version.name === preferredVersionName) ?? null;
const savePreferredVersionName = useCallback((versionName) => {
api.savePreferredVersion(pluginId, versionName);
}, [api, pluginId]);
return { preferredVersion, savePreferredVersionName };
}
export function useDocsPreferredVersionByPluginId() {
const allDocsData = useAllDocsData();
const [state] = useDocsPreferredVersionContext();
function getPluginIdPreferredVersion(pluginId) {
const docsData = allDocsData[pluginId];
const { preferredVersionName } = state[pluginId];
return (docsData.versions.find((version) => version.name === preferredVersionName) ?? null);
}
const pluginIds = Object.keys(allDocsData);
return Object.fromEntries(pluginIds.map((id) => [id, getPluginIdPreferredVersion(id)]));
}
//# sourceMappingURL=docsPreferredVersion.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"docsPreferredVersion.js","sourceRoot":"","sources":["../../src/contexts/docsPreferredVersion.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,EACR,WAAW,GAEZ,MAAM,OAAO,CAAC;AACf,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,wCAAwC,CAAC;AAChD,OAAO,E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C;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC,WAAW,CACvB,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,2BAA2B,CAAC,EAAE,CAAC,CAAC,CAAC,CAC7D,CAAC;AACJ,CAAC"}

View File

@@ -0,0 +1,26 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
import type { PropSidebar } from '@docusaurus/plugin-content-docs';
type ContextValue = {
name: string;
items: PropSidebar;
};
/**
* Provide the current sidebar to your children.
*/
export declare function DocsSidebarProvider({ children, name, items, }: {
children: ReactNode;
name: string | undefined;
items: PropSidebar | undefined;
}): JSX.Element;
/**
* Gets the sidebar that's currently displayed, or `null` if there isn't one
*/
export declare function useDocsSidebar(): ContextValue | null;
export {};
//# sourceMappingURL=docsSidebar.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"docsSidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/docsSidebar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAsB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAEjE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,iCAAiC,CAAC;AAMjE,KAAK,YAAY,GAAG;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAC,CAAC;AAMvD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,IAAI,EACJ,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;CAChC,GAAG,GAAG,CAAC,OAAO,CAMd;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,YAAY,GAAG,IAAI,CAMpD"}

View File

@@ -0,0 +1,30 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useMemo, useContext } from 'react';
import { ReactContextError } from '../utils/reactUtils';
// Using a Symbol because null is a valid context value (a doc with no sidebar)
// Inspired by https://github.com/jamiebuilds/unstated-next/blob/master/src/unstated-next.tsx
const EmptyContext = Symbol('EmptyContext');
const Context = React.createContext(EmptyContext);
/**
* Provide the current sidebar to your children.
*/
export function DocsSidebarProvider({ children, name, items, }) {
const stableValue = useMemo(() => (name && items ? { name, items } : null), [name, items]);
return <Context.Provider value={stableValue}>{children}</Context.Provider>;
}
/**
* Gets the sidebar that's currently displayed, or `null` if there isn't one
*/
export function useDocsSidebar() {
const value = useContext(Context);
if (value === EmptyContext) {
throw new ReactContextError('DocsSidebarProvider');
}
return value;
}
//# sourceMappingURL=docsSidebar.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"docsSidebar.js","sourceRoot":"","sources":["../../src/contexts/docsSidebar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAC,OAAO,EAAE,UAAU,EAAiB,MAAM,OAAO,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAGtD,+EAA+E;AAC/E,6FAA6F;AAC7F,MAAM,YAAY,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAI3D,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CACjC,YAAY,CACb,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,IAAI,EACJ,KAAK,GAKN;IACC,MAAM,WAAW,GAAwB,OAAO,CAC9C,GAAG,EAAE,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAC5C,CAAC,IAAI,EAAE,KAAK,CAAC,CACd,CAAC;IACF,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,KAAK,KAAK,YAAY,EAAE;QAC1B,MAAM,IAAI,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;KACpD;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}

View File

@@ -0,0 +1,20 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
import type { PropVersionMetadata } from '@docusaurus/plugin-content-docs';
/**
* Provide the current version's metadata to your children.
*/
export declare function DocsVersionProvider({ children, version, }: {
children: ReactNode;
version: PropVersionMetadata | null;
}): JSX.Element;
/**
* Gets the version metadata of the current doc page.
*/
export declare function useDocsVersion(): PropVersionMetadata;
//# sourceMappingURL=docsVersion.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"docsVersion.d.ts","sourceRoot":"","sources":["../../src/contexts/docsVersion.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAAC,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAExD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAIzE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACrC,GAAG,GAAG,CAAC,OAAO,CAEd;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,mBAAmB,CAMpD"}

View File

@@ -0,0 +1,26 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useContext } from 'react';
import { ReactContextError } from '../utils/reactUtils';
const Context = React.createContext(null);
/**
* Provide the current version's metadata to your children.
*/
export function DocsVersionProvider({ children, version, }) {
return <Context.Provider value={version}>{children}</Context.Provider>;
}
/**
* Gets the version metadata of the current doc page.
*/
export function useDocsVersion() {
const version = useContext(Context);
if (version === null) {
throw new ReactContextError('DocsVersionProvider');
}
return version;
}
//# sourceMappingURL=docsVersion.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"docsVersion.js","sourceRoot":"","sources":["../../src/contexts/docsVersion.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EAAiB,UAAU,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAGtD,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAA6B,IAAI,CAAC,CAAC;AAEtE;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,OAAO,GAIR;IACC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AACzE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,OAAO,KAAK,IAAI,EAAE;QACpB,MAAM,IAAI,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;KACpD;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}

View File

@@ -0,0 +1,31 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
type ContextValue = {
/**
* Mobile sidebar should be disabled in case it's empty, i.e. no secondary
* menu + no navbar items). If disabled, the toggle button should not be
* displayed at all.
*/
disabled: boolean;
/**
* Signals whether the actual sidebar should be displayed (contrary to
* `disabled` which is about the toggle button). Sidebar should not visible
* until user interaction to avoid SSR rendering.
*/
shouldRender: boolean;
/** The displayed state. Can be toggled with the `toggle` callback. */
shown: boolean;
/** Toggle the `shown` attribute. */
toggle: () => void;
};
export declare function NavbarMobileSidebarProvider({ children, }: {
children: ReactNode;
}): JSX.Element;
export declare function useNavbarMobileSidebar(): ContextValue;
export {};
//# sourceMappingURL=navbarMobileSidebar.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"navbarMobileSidebar.d.ts","sourceRoot":"","sources":["../../src/contexts/navbarMobileSidebar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAOf,KAAK,YAAY,GAAG;IAClB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB,sEAAsE;IACtE,KAAK,EAAE,OAAO,CAAC;IACf,oCAAoC;IACpC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AA8CF,wBAAgB,2BAA2B,CAAC,EAC1C,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAGd;AAED,wBAAgB,sBAAsB,IAAI,YAAY,CAMrD"}

View File

@@ -0,0 +1,56 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useCallback, useEffect, useState, useMemo, } from 'react';
import { useNavbarSecondaryMenuContent } from './navbarSecondaryMenu/content';
import { useWindowSize } from '../hooks/useWindowSize';
import { useHistoryPopHandler } from '../utils/historyUtils';
import { useThemeConfig } from '../utils/useThemeConfig';
import { ReactContextError } from '../utils/reactUtils';
const Context = React.createContext(undefined);
function useIsNavbarMobileSidebarDisabled() {
const secondaryMenuContent = useNavbarSecondaryMenuContent();
const { items } = useThemeConfig().navbar;
return items.length === 0 && !secondaryMenuContent.component;
}
function useContextValue() {
const disabled = useIsNavbarMobileSidebarDisabled();
const windowSize = useWindowSize();
const shouldRender = !disabled && windowSize === 'mobile';
const [shown, setShown] = useState(false);
// Close mobile sidebar on navigation pop
// Most likely firing when using the Android back button (but not only)
useHistoryPopHandler(() => {
if (shown) {
setShown(false);
// Prevent pop navigation; seems desirable enough
// See https://github.com/facebook/docusaurus/pull/5462#issuecomment-911699846
return false;
}
return undefined;
});
const toggle = useCallback(() => {
setShown((s) => !s);
}, []);
useEffect(() => {
if (windowSize === 'desktop') {
setShown(false);
}
}, [windowSize]);
return useMemo(() => ({ disabled, shouldRender, toggle, shown }), [disabled, shouldRender, toggle, shown]);
}
export function NavbarMobileSidebarProvider({ children, }) {
const value = useContextValue();
return <Context.Provider value={value}>{children}</Context.Provider>;
}
export function useNavbarMobileSidebar() {
const context = React.useContext(Context);
if (context === undefined) {
throw new ReactContextError('NavbarMobileSidebarProvider');
}
return context;
}
//# sourceMappingURL=navbarMobileSidebar.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"navbarMobileSidebar.js","sourceRoot":"","sources":["../../src/contexts/navbarMobileSidebar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,OAAO,GAER,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,6BAA6B,EAAC,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAC,MAAM,yBAA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AAY,EAAE,MAAM,EAAE,KAAK,EAAC,CAAC,EAC/C,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,CACxC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,EAC1C,QAAQ,GAGT;IACC,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAChC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,MAAM,IAAI,iBAAiB,CAAC,6BAA6B,CAAC,CAAC;KAC5D;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}

View File

@@ -0,0 +1,37 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode, type ComponentType } from 'react';
export type NavbarSecondaryMenuComponent<Props> = ComponentType<Props>;
/** @internal */
export type Content = {
component: NavbarSecondaryMenuComponent<object>;
props: object;
} | {
component: null;
props: null;
};
/** @internal */
export declare function NavbarSecondaryMenuContentProvider({ children, }: {
children: ReactNode;
}): JSX.Element;
/** @internal */
export declare function useNavbarSecondaryMenuContent(): Content;
/**
* This component renders nothing by itself, but it fills the placeholder in the
* generic secondary menu layout. This reduces coupling between the main layout
* and the specific page.
*
* This kind of feature is often called portal/teleport/gateway/outlet...
* Various unmaintained React libs exist. Most up-to-date one:
* https://github.com/gregberge/react-teleporter
* Not sure any of those is safe regarding concurrent mode.
*/
export declare function NavbarSecondaryMenuFiller<P extends object>({ component, props, }: {
component: NavbarSecondaryMenuComponent<P>;
props: P;
}): JSX.Element | null;
//# sourceMappingURL=content.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/contexts/navbarSecondaryMenu/content.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAIZ,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AAUf,MAAM,MAAM,4BAA4B,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;AAEvE,gBAAgB;AAChB,MAAM,MAAM,OAAO,GACf;IACE,SAAS,EAAE,4BAA4B,CAAC,MAAM,CAAC,CAAC;IAChD,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IAAC,SAAS,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAC,CAAC;AASnC,gBAAgB;AAChB,wBAAgB,kCAAkC,CAAC,EACjD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAMd;AAED,gBAAgB;AAChB,wBAAgB,6BAA6B,IAAI,OAAO,CAMvD;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,EAAE,EAC1D,SAAS,EACT,KAAK,GACN,EAAE;IACD,SAAS,EAAE,4BAA4B,CAAC,CAAC,CAAC,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC;CACV,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAqBrB"}

View File

@@ -0,0 +1,50 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useState, useContext, useEffect, } from 'react';
import { ReactContextError, useShallowMemoObject } from '../../utils/reactUtils';
const Context = React.createContext(null);
/** @internal */
export function NavbarSecondaryMenuContentProvider({ children, }) {
const value = useState({ component: null, props: null });
return (
// @ts-expect-error: this context is hard to type
<Context.Provider value={value}>{children}</Context.Provider>);
}
/** @internal */
export function useNavbarSecondaryMenuContent() {
const value = useContext(Context);
if (!value) {
throw new ReactContextError('NavbarSecondaryMenuContentProvider');
}
return value[0];
}
/**
* This component renders nothing by itself, but it fills the placeholder in the
* generic secondary menu layout. This reduces coupling between the main layout
* and the specific page.
*
* This kind of feature is often called portal/teleport/gateway/outlet...
* Various unmaintained React libs exist. Most up-to-date one:
* https://github.com/gregberge/react-teleporter
* Not sure any of those is safe regarding concurrent mode.
*/
export function NavbarSecondaryMenuFiller({ component, props, }) {
const context = useContext(Context);
if (!context) {
throw new ReactContextError('NavbarSecondaryMenuContentProvider');
}
const [, setContent] = context;
// To avoid useless context re-renders, props are memoized shallowly
const memoizedProps = useShallowMemoObject(props);
useEffect(() => {
// @ts-expect-error: this context is hard to type
setContent({ component, props: memoizedProps });
}, [setContent, component, memoizedProps]);
useEffect(() => () => setContent({ component: null, props: null }), [setContent]);
return null;
}
//# sourceMappingURL=content.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../../src/contexts/navbarSecondaryMenu/content.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,GAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAwB/E,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAsB,IAAI,CAAC,CAAC;AAE/D,gBAAgB;AAChB,MAAM,UAAU,kCAAkC,CAAC,EACjD,QAAQ,GAGT;IACC,MAAM,KAAK,GAAG,QAAQ,CAAC,EAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;IACvD,OAAO;IACL,iDAAiD;IACjD,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAC9D,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,6BAA6B;IAC3C,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,iBAAiB,CAAC,oCAAoC,CAAC,CAAC;KACnE;IACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB,CAAmB,EAC1D,SAAS,EACT,KAAK,GAIN;IACC,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,iBAAiB,CAAC,oCAAoC,CAAC,CAAC;KACnE;IACD,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC;IAE/B,oEAAoE;IACpE,MAAM,aAAa,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,iDAAiD;QACjD,UAAU,CAAC,EAAC,SAAS,EAAE,KAAK,EAAE,aAAa,EAAC,CAAC,CAAC;IAChD,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;IAE3C,SAAS,CACP,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,EAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC,EACtD,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC"}

View File

@@ -0,0 +1,24 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type ReactNode } from 'react';
/** @internal */
export declare function NavbarSecondaryMenuDisplayProvider({ children, }: {
children: ReactNode;
}): JSX.Element;
/** Wires the logic for rendering the mobile navbar secondary menu. */
export declare function useNavbarSecondaryMenu(): {
/** Whether secondary menu is displayed. */
shown: boolean;
/**
* Hide the secondary menu; fired either when hiding the entire sidebar, or
* when going back to the primary menu.
*/
hide: () => void;
/** The content returned from the current secondary menu filler. */
content: JSX.Element | undefined;
};
//# sourceMappingURL=display.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../../src/contexts/navbarSecondaryMenu/display.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAc,EAMZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA6Cf,gBAAgB;AAChB,wBAAgB,kCAAkC,CAAC,EACjD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,GAAG,CAAC,OAAO,CAGd;AAUD,sEAAsE;AACtE,wBAAgB,sBAAsB,IAAI;IACxC,2CAA2C;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,mEAAmE;IACnE,OAAO,EAAE,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC;CAClC,CAaA"}

View File

@@ -0,0 +1,62 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { useState, useContext, useEffect, useMemo, useCallback, } from 'react';
import { ReactContextError, usePrevious } from '../../utils/reactUtils';
import { useNavbarMobileSidebar } from '../navbarMobileSidebar';
import { useNavbarSecondaryMenuContent } from './content';
const Context = React.createContext(null);
function useContextValue() {
const mobileSidebar = useNavbarMobileSidebar();
const content = useNavbarSecondaryMenuContent();
const [shown, setShown] = useState(false);
const hasContent = content.component !== null;
const previousHasContent = usePrevious(hasContent);
// When content is become available for the first time (set in useEffect)
// we set this content to be shown!
useEffect(() => {
const contentBecameAvailable = hasContent && !previousHasContent;
if (contentBecameAvailable) {
setShown(true);
}
}, [hasContent, previousHasContent]);
// On sidebar close, secondary menu is set to be shown on next re-opening
// (if any secondary menu content available)
useEffect(() => {
if (!hasContent) {
setShown(false);
return;
}
if (!mobileSidebar.shown) {
setShown(true);
}
}, [mobileSidebar.shown, hasContent]);
return useMemo(() => [shown, setShown], [shown]);
}
/** @internal */
export function NavbarSecondaryMenuDisplayProvider({ children, }) {
const value = useContextValue();
return <Context.Provider value={value}>{children}</Context.Provider>;
}
function renderElement(content) {
if (content.component) {
const Comp = content.component;
return <Comp {...content.props}/>;
}
return undefined;
}
/** Wires the logic for rendering the mobile navbar secondary menu. */
export function useNavbarSecondaryMenu() {
const value = useContext(Context);
if (!value) {
throw new ReactContextError('NavbarSecondaryMenuDisplayProvider');
}
const [shown, setShown] = value;
const hide = useCallback(() => setShown(false), [setShown]);
const content = useNavbarSecondaryMenuContent();
return useMemo(() => ({ shown, hide, content: renderElement(content) }), [hide, content, shown]);
}
//# sourceMappingURL=display.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../../src/contexts/navbarSecondaryMenu/display.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACP,WAAW,GAEZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,iBAAiB,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAC,sBAAsB,EAAC,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAC,6BAA6B,EAAe,MAAM,WAAW,CAAC;AAOtE,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAsB,IAAI,CAAC,CAAC;AAE/D,SAAS,eAAe;IACtB,MAAM,aAAa,GAAG,sBAAsB,EAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,6BAA6B,EAAE,CAAC;IAEhD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,UAAU,GAAG,OAAO,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