-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
29 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,2 @@ | ||
// TypeScript Version: 3.4 | ||
|
||
import { | ||
h, | ||
Context, | ||
AnyComponent, | ||
FunctionComponent | ||
} from 'preact' | ||
|
||
/** | ||
* Mapping of names for JSX components to React components | ||
*/ | ||
interface ComponentDictionary { | ||
[name: string]: AnyComponent<any> | ||
} | ||
|
||
/** | ||
* Prop type that includes a component dictionary | ||
*/ | ||
interface ComponentsProp { | ||
/** | ||
* Mapping of names for JSX components to React components | ||
*/ | ||
components?: ComponentDictionary, | ||
} | ||
|
||
/** | ||
* Direct access to the MDX React Context | ||
*/ | ||
declare const MDXContext: Context<ComponentsProp> | ||
|
||
/** | ||
* Provider for MDX context | ||
*/ | ||
declare const MDXProvider: FunctionComponent<ComponentsProp> | ||
|
||
/** | ||
* Gets components from the MDX Context | ||
* | ||
* @param components additional components to include | ||
* @returns all components from context with overrides from components parameter | ||
*/ | ||
declare function useMDXComponents( | ||
components: ComponentDictionary | (() => ComponentDictionary) | ||
): ComponentDictionary | ||
|
||
/** | ||
* High order component that passes components prop to child | ||
* | ||
* @param child Component being wrapped | ||
*/ | ||
declare function withMDXComponents( | ||
child: AnyComponent<ComponentsProp> | ||
): ReactElement | null | ||
|
||
/** | ||
* Preact hyperscript function wrapped with handler for MDX content | ||
*/ | ||
declare const mdx: typeof h | ||
|
||
export { | ||
ComponentDictionary, | ||
ComponentsProp, | ||
MDXContext, | ||
MDXProvider, | ||
useMDXComponents, | ||
withMDXComponents, | ||
mdx | ||
} | ||
export { default as mdx } from "./create-element"; | ||
export { default as MDXContext, MDXProvider, useMDXComponents, withMDXComponents } from "./context"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,2 @@ | ||
// TypeScript Version: 3.4 | ||
|
||
import { | ||
Context, | ||
Consumer, | ||
ComponentType, | ||
FunctionComponent, | ||
ReactElement, | ||
createElement | ||
} from 'react' | ||
|
||
/** | ||
* Mapping of names for JSX components to React components | ||
*/ | ||
interface ComponentDictionary { | ||
[name: string]: ComponentType<any> | ||
} | ||
|
||
/** | ||
* Prop type that includes a component dictionary | ||
*/ | ||
interface ComponentsProp { | ||
/** | ||
* Mapping of names for JSX components to React components | ||
*/ | ||
components?: ComponentDictionary, | ||
/** | ||
* Turn off outer component context | ||
* | ||
* @defaultValue false | ||
*/ | ||
disableParentContext?: boolean | ||
} | ||
|
||
/** | ||
* Direct access to the MDX React Context | ||
*/ | ||
declare const MDXContext: Context<ComponentsProp> | ||
|
||
/** | ||
* Provider for MDX context | ||
*/ | ||
declare const MDXProvider: FunctionComponent<ComponentsProp> | ||
|
||
/** | ||
* Gets components from the MDX Context | ||
* | ||
* @param components additional components to include | ||
* @returns all components from context with overrides from components parameter | ||
*/ | ||
declare function useMDXComponents( | ||
components: ComponentDictionary | (() => ComponentDictionary) | ||
): ComponentDictionary | ||
|
||
/** | ||
* High order component that passes components prop to child | ||
* | ||
* @param child Component being wrapped | ||
*/ | ||
declare function withMDXComponents( | ||
child: ComponentType<ComponentsProp> | ||
): ReactElement | null | ||
|
||
/** | ||
* React createElement function wrapped with handler for MDX content | ||
*/ | ||
declare const mdx: typeof createElement | ||
|
||
export { | ||
ComponentDictionary, | ||
ComponentsProp, | ||
MDXContext, | ||
MDXProvider, | ||
useMDXComponents, | ||
withMDXComponents, | ||
mdx | ||
} | ||
export { default as mdx } from "./create-element"; | ||
export { default as MDXContext, MDXProvider, useMDXComponents, withMDXComponents } from "./context"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,9 @@ | ||
// TypeScript Version: 3.5 | ||
|
||
import {FunctionComponent} from 'react' | ||
import {Options} from '@mdx-js/mdx' | ||
import {ComponentsProp} from '@mdx-js/react' | ||
|
||
/** | ||
* Properties for the MDX Runtime component | ||
*/ | ||
export interface MDXRuntimeProps | ||
extends Omit<Options, 'footnotes' | 'compilers'>, | ||
Partial<ComponentsProp> { | ||
/** | ||
* MDX text | ||
*/ | ||
children?: string | ||
|
||
/** | ||
* Values in usable in MDX scope | ||
*/ | ||
scope?: { | ||
[variableName: string]: unknown | ||
} | ||
} | ||
|
||
/** | ||
* Renders child MDX text as a React component | ||
*/ | ||
declare const mdxRuntime: FunctionComponent<MDXRuntimeProps> | ||
|
||
export default mdxRuntime | ||
declare function _default({ scope, components, remarkPlugins, rehypePlugins, children, ...props }: { | ||
[x: string]: any; | ||
scope?: {}; | ||
components?: {}; | ||
remarkPlugins?: any[]; | ||
rehypePlugins?: any[]; | ||
children: any; | ||
}): any; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
// TypeScript Version: 3.4 | ||
|
||
import {CreateElement} from 'vue' | ||
|
||
/** | ||
* Vue createElement function wrapped with handler for MDX content | ||
*/ | ||
declare const createElement: CreateElement | ||
|
||
export default createElement | ||
export { default as mdx } from "./create-element"; | ||
export { default as MDXProvider } from "./mdx-provider"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16701,12 +16701,10 @@ mkdirp-promise@^5.0.1: | |
dependencies: | ||
mkdirp "*" | ||
|
||
mkdirp@*, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5, mkdirp@~0.5.1: | ||
version "0.5.5" | ||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" | ||
integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== | ||
dependencies: | ||
minimist "^1.2.5" | ||
mkdirp@*, mkdirp@^1.0.4: | ||
version "1.0.4" | ||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" | ||
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== | ||
|
||
[email protected]: | ||
version "0.5.3" | ||
|
@@ -16715,10 +16713,12 @@ [email protected]: | |
dependencies: | ||
minimist "^1.2.5" | ||
|
||
mkdirp@^1.0.4: | ||
version "1.0.4" | ||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" | ||
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== | ||
"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5, mkdirp@~0.5.1: | ||
version "0.5.5" | ||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" | ||
integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== | ||
dependencies: | ||
minimist "^1.2.5" | ||
|
||
modify-values@^1.0.0: | ||
version "1.0.1" | ||
|
@@ -20474,7 +20474,7 @@ read@1, read@^1.0.7, read@~1.0.1: | |
dependencies: | ||
mute-stream "~0.0.4" | ||
|
||
"readable-stream@1 || 2", "readable-stream@2 || 3", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.3, readable-stream@~2.3.6: | ||
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.3, readable-stream@~2.3.6: | ||
version "2.3.7" | ||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" | ||
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== | ||
|
@@ -20487,7 +20487,7 @@ read@1, read@^1.0.7, read@~1.0.1: | |
string_decoder "~1.1.1" | ||
util-deprecate "~1.0.1" | ||
|
||
readable-stream@3, readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: | ||
"readable-stream@2 || 3", readable-stream@3, readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: | ||
version "3.6.0" | ||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" | ||
integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== | ||
|
@@ -22292,12 +22292,12 @@ sade@^1.4.2, sade@^1.7.4: | |
dependencies: | ||
mri "^1.1.0" | ||
|
||
[email protected], safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: | ||
[email protected], safe-buffer@~5.1.0, safe-buffer@~5.1.1: | ||
version "5.1.2" | ||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" | ||
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== | ||
|
||
safe-buffer@^5.2.0: | ||
safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0: | ||
version "5.2.1" | ||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" | ||
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== | ||
|