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

44
node_modules/@mdx-js/react/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,44 @@
/**
* Get current components from the MDX Context.
*
* @param {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]
* Additional components to use or a function that creates them (optional).
* @returns {MDXComponents}
* Current components.
*/
export function useMDXComponents(components?: Readonly<MDXComponents> | MergeComponents | null | undefined): MDXComponents;
/**
* Provider for MDX context.
*
* @param {Readonly<Props>} properties
* Properties.
* @returns {JSX.Element}
* Element.
* @satisfies {Component}
*/
export function MDXProvider(properties: Readonly<Props>): JSX.Element;
export type MDXComponents = import('mdx/types.js').MDXComponents;
export type Component = import('react').Component<{}, {}, unknown>;
export type ReactNode = import('react').ReactNode;
/**
* Custom merge function.
*/
export type MergeComponents = (currentComponents: Readonly<MDXComponents>) => MDXComponents;
/**
* Configuration for `MDXProvider`.
*/
export type Props = {
/**
* Children (optional).
*/
children?: ReactNode | null | undefined;
/**
* Additional components to use or a function that creates them (optional).
*/
components?: Readonly<MDXComponents> | MergeComponents | null | undefined;
/**
* Turn off outer component context (default: `false`).
*/
disableParentContext?: boolean | null | undefined;
};
//# sourceMappingURL=index.d.ts.map

1
node_modules/@mdx-js/react/lib/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AA+BA;;;;;;;GAOG;AACH,8CALW,SAAS,aAAa,CAAC,GAAG,eAAe,GAAG,IAAI,GAAG,SAAS,GAE1D,aAAa,CAkBzB;AAED;;;;;;;;GAQG;AACH,wCANW,SAAS,KAAK,CAAC,GAEb,WAAW,CAsBvB;4BAlFY,OAAO,cAAc,EAAE,aAAa;wBACpC,OAAO,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC;wBAC1C,OAAO,OAAO,EAAE,SAAS;;;;kDAM3B,SAAS,aAAa,CAAC,KAErB,aAAa;;;;;;;;eAKZ,SAAS,GAAG,IAAI,GAAG,SAAS;;;;iBAE5B,SAAS,aAAa,CAAC,GAAG,eAAe,GAAG,IAAI,GAAG,SAAS;;;;2BAE5D,OAAO,GAAG,IAAI,GAAG,SAAS"}

84
node_modules/@mdx-js/react/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
/**
* @typedef {import('mdx/types.js').MDXComponents} MDXComponents
* @typedef {import('react').Component<{}, {}, unknown>} Component
* @typedef {import('react').ReactNode} ReactNode
*/
/**
* @callback MergeComponents
* Custom merge function.
* @param {Readonly<MDXComponents>} currentComponents
* Current components from the context.
* @returns {MDXComponents}
* Additional components.
*
* @typedef Props
* Configuration for `MDXProvider`.
* @property {ReactNode | null | undefined} [children]
* Children (optional).
* @property {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]
* Additional components to use or a function that creates them (optional).
* @property {boolean | null | undefined} [disableParentContext=false]
* Turn off outer component context (default: `false`).
*/
import React from 'react'
/** @type {Readonly<MDXComponents>} */
const emptyComponents = {}
const MDXContext = React.createContext(emptyComponents)
/**
* Get current components from the MDX Context.
*
* @param {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]
* Additional components to use or a function that creates them (optional).
* @returns {MDXComponents}
* Current components.
*/
export function useMDXComponents(components) {
const contextComponents = React.useContext(MDXContext)
// Memoize to avoid unnecessary top-level context changes
return React.useMemo(
function () {
// Custom merge via a function prop
if (typeof components === 'function') {
return components(contextComponents)
}
return {...contextComponents, ...components}
},
[contextComponents, components]
)
}
/**
* Provider for MDX context.
*
* @param {Readonly<Props>} properties
* Properties.
* @returns {JSX.Element}
* Element.
* @satisfies {Component}
*/
export function MDXProvider(properties) {
/** @type {Readonly<MDXComponents>} */
let allComponents
if (properties.disableParentContext) {
allComponents =
typeof properties.components === 'function'
? properties.components(emptyComponents)
: properties.components || emptyComponents
} else {
allComponents = useMDXComponents(properties.components)
}
return React.createElement(
MDXContext.Provider,
{value: allComponents},
properties.children
)
}