@moneko/react 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mdx.d.ts +2 -3
- package/mdx.js.map +1 -1
- package/package.json +1 -1
package/mdx.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface MDXComponents {
|
|
2
|
+
export interface MDXComponents {
|
|
3
3
|
[k: string]: (props: Record<string, any>) => JSX.Element;
|
|
4
4
|
}
|
|
5
|
-
interface MDXProviderProps extends React.Component {
|
|
5
|
+
export interface MDXProviderProps extends React.Component {
|
|
6
6
|
children: JSX.Element;
|
|
7
7
|
components: MDXComponents | ((props: Record<string, any>) => MDXComponents);
|
|
8
8
|
disableParentContext?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare function useMDXComponents(components: MDXComponents | ((props: Record<string, any>) => MDXComponents)): MDXComponents;
|
|
11
11
|
export declare function MDXProvider(props: MDXProviderProps): JSX.Element;
|
|
12
|
-
export {};
|
package/mdx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["mdx.ts"],"names":[],"mappings":"AAAA,OAAO,MAAW,OAAQ,CAU1B,IAAM,EAA2C,CAAC,EAC5C,EAAa,EAAM,aAAa,CAAC,EAEvC,QAAO,SAAS,iBACd,CAA2E,EAE3E,IAAM,EAAoB,EAAM,UAAU,CAAC,GAE3C,OAAO,EAAM,OAAO,CAClB,iBACE,AAAI,AAAsB,YAAtB,OAAO,EACF,EAAW,GAGb,CAAE,GAAG,CAAiB,CAAE,GAAG,CAAU,AAAC,CAC/C,EACA,CAAC,EAAmB,EAAW,CAEnC,CAEA,OAAO,SAAS,YAAY,CAAuB,EAEjD,IAAI,EAWJ,OARE,EADE,EAAM,oBAAoB,CAE1B,AAA4B,YAA5B,OAAO,EAAM,UAAU,CACnB,EAAM,UAAU,CAAC,GACjB,EAAM,UAAU,EAAI,EAEV,iBAAiB,EAAM,UAAU,EAG5C,EAAM,aAAa,CAAC,EAAW,QAAQ,CAAE,CAAE,MAAO,CAAc,EAAG,EAAM,QAAQ,CAC1F","file":"mdx.js","sourcesContent":["import React from 'react';\n\
|
|
1
|
+
{"version":3,"sources":["mdx.ts"],"names":[],"mappings":"AAAA,OAAO,MAAW,OAAQ,CAU1B,IAAM,EAA2C,CAAC,EAC5C,EAAa,EAAM,aAAa,CAAC,EAEvC,QAAO,SAAS,iBACd,CAA2E,EAE3E,IAAM,EAAoB,EAAM,UAAU,CAAC,GAE3C,OAAO,EAAM,OAAO,CAClB,iBACE,AAAI,AAAsB,YAAtB,OAAO,EACF,EAAW,GAGb,CAAE,GAAG,CAAiB,CAAE,GAAG,CAAU,AAAC,CAC/C,EACA,CAAC,EAAmB,EAAW,CAEnC,CAEA,OAAO,SAAS,YAAY,CAAuB,EAEjD,IAAI,EAWJ,OARE,EADE,EAAM,oBAAoB,CAE1B,AAA4B,YAA5B,OAAO,EAAM,UAAU,CACnB,EAAM,UAAU,CAAC,GACjB,EAAM,UAAU,EAAI,EAEV,iBAAiB,EAAM,UAAU,EAG5C,EAAM,aAAa,CAAC,EAAW,QAAQ,CAAE,CAAE,MAAO,CAAc,EAAG,EAAM,QAAQ,CAC1F","file":"mdx.js","sourcesContent":["import React from 'react';\n\nexport interface MDXComponents {\n [k: string]: (props: Record<string, any>) => JSX.Element;\n}\nexport interface MDXProviderProps extends React.Component {\n children: JSX.Element;\n components: MDXComponents | ((props: Record<string, any>) => MDXComponents);\n disableParentContext?: boolean;\n}\nconst emptyComponents: Readonly<MDXComponents> = {};\nconst MDXContext = React.createContext(emptyComponents);\n\nexport function useMDXComponents(\n components: MDXComponents | ((props: Record<string, any>) => MDXComponents),\n): MDXComponents {\n const contextComponents = React.useContext(MDXContext);\n\n return React.useMemo(\n function () {\n if (typeof components === 'function') {\n return components(contextComponents);\n }\n\n return { ...contextComponents, ...components };\n },\n [contextComponents, components],\n );\n}\n\nexport function MDXProvider(props: MDXProviderProps): JSX.Element {\n /** @type {Readonly<MDXComponents>} */\n let allComponents: Readonly<MDXComponents>;\n\n if (props.disableParentContext) {\n allComponents =\n typeof props.components === 'function'\n ? props.components(emptyComponents)\n : props.components || emptyComponents;\n } else {\n allComponents = useMDXComponents(props.components);\n }\n\n return React.createElement(MDXContext.Provider, { value: allComponents }, props.children);\n}\n"]}
|