@mdxeditor/editor
Advanced tools
Comparing version 0.9.0 to 0.10.0-alpha.1
1131
dist/index.d.ts
@@ -7,1089 +7,44 @@ /** | ||
*/ | ||
/// <reference types="react" /> | ||
import { AdmonitionKind } from 'lexical'; | ||
import { ContentEditable } from '@lexical/react/LexicalContentEditable'; | ||
import { DecoratorNode } from 'lexical'; | ||
import type { DOMConversionMap } from 'lexical'; | ||
import type { DOMExportOutput } from 'lexical'; | ||
import { EditorConfig } from 'lexical'; | ||
import { EditorThemeClasses } from 'lexical'; | ||
import { ElementNode } from 'lexical'; | ||
import { FromMarkdownOptions } from 'mdast-util-from-markdown/lib'; | ||
import { Klass } from 'lexical'; | ||
import { LeafDirective } from 'mdast-util-directive'; | ||
import { LexicalEditor } from 'lexical'; | ||
import { LexicalNode } from 'lexical'; | ||
import * as Mdast from 'mdast'; | ||
import { MdxJsxAttribute } from 'mdast-util-mdx-jsx'; | ||
import { NodeKey } from 'lexical'; | ||
import { ParseOptions } from 'mdast-util-from-markdown/lib'; | ||
import * as RadixToolbar from '@radix-ui/react-toolbar'; | ||
import { RangeSelection } from 'lexical'; | ||
import { default as React_2 } from 'react'; | ||
import { RootNode } from 'lexical'; | ||
import { SandpackProvider } from '@codesandbox/sandpack-react'; | ||
import { SerializedEditorState } from 'lexical'; | ||
import { SerializedElementNode } from 'lexical'; | ||
import { SerializedLexicalNode } from 'lexical'; | ||
import { Spread } from 'lexical'; | ||
import { ToMarkdownExtension as ToMarkdownExtension_2 } from 'mdast-util-mdx'; | ||
import { Options as ToMarkdownOptions } from 'mdast-util-to-markdown'; | ||
import { ToMarkdownOptions as ToMarkdownOptions_2 } from 'mdast-util-mdx'; | ||
/** | ||
* Creates an {@link AdmonitionNode}. | ||
* @param kind - The kind of admonition to create. Accepts `'note' | 'tip' | 'danger' | 'info' | 'caution'` | ||
*/ | ||
export declare function $createAdmonitionNode(kind?: AdmonitionKind): AdmonitionNode; | ||
/** | ||
* Creates a {@link CodeBlockNode}. | ||
* @param options - The code contents, the language (i.e. js, jsx, etc.), and the additional meta data of the block. | ||
*/ | ||
export declare function $createCodeBlockNode(options: CreateCodeBlockNodeOptions): CodeBlockNode; | ||
/** | ||
* Creates a {@link FrontmatterNode}. | ||
* @param yaml - The YAML string of the frontmatter. | ||
*/ | ||
export declare function $createFrontmatterNode(yaml: string): FrontmatterNode; | ||
/** | ||
* Creates an {@link ImageNode}. | ||
* @param options - The payload to create an image. The keys map to the img tag attributes. | ||
*/ | ||
export declare function $createImageNode(options: CreateImageNodeOptions): ImageNode; | ||
/** | ||
* Creates a {@link JsxNode}. | ||
* @param options - The payload necessary for the creation of a {@link JsxNode}. | ||
* | ||
* @see {@link CreateJsxNodeOptions} for more details. | ||
*/ | ||
export declare function $createJsxNode(options: CreateJsxNodeOptions): JsxNode; | ||
/** | ||
* Creates an {@link LeafDirectiveNode}. | ||
*/ | ||
export declare function $createLeafDirectiveNode(mdastNode: LeafDirective): LeafDirectiveNode; | ||
/** | ||
* Creates a {@link SandpackNode}. | ||
*/ | ||
export declare function $createSandpackNode(options: CreateSandpackNodeOptions): SandpackNode; | ||
/** | ||
* Creates a {@link TableNode} | ||
* @param mdastNode - The mdast node to create the {@link TableNode} from. | ||
*/ | ||
export declare function $createTableNode(mdastNode: Mdast.Table): TableNode; | ||
/** | ||
* Returns `true` if the given node is an {@link AdmonitionNode}. | ||
*/ | ||
export declare function $isAdmonitionNode(node: LexicalNode | null | undefined): node is AdmonitionNode; | ||
/** | ||
* Returns true if the given node is a {@link CodeBlockNode}. | ||
*/ | ||
export declare function $isCodeBlockNode(node: LexicalNode | null | undefined): node is CodeBlockNode; | ||
/** | ||
* Returns `true` if the given node is a {@link FrontmatterNode}. | ||
*/ | ||
export declare function $isFrontmatterNode(node: LexicalNode | null | undefined): node is FrontmatterNode; | ||
/** | ||
* Retruns true if the node is an {@link ImageNode}. | ||
*/ | ||
export declare function $isImageNode(node: LexicalNode | null | undefined): node is ImageNode; | ||
/** | ||
* Returns true if a node is a {@link JsxNode}. | ||
*/ | ||
export declare function $isJsxNode(node: LexicalNode | null | undefined): node is JsxNode; | ||
/** | ||
* Retruns true if the node is an {@link LeafDirectiveNode}. | ||
*/ | ||
export declare function $isLeafDirectiveNode(node: LexicalNode | null | undefined): node is LeafDirectiveNode; | ||
/** | ||
* Returns true if the given node is a {@link SandpackNode}. | ||
*/ | ||
export declare function $isSandpackNode(node: LexicalNode | null | undefined): node is SandpackNode; | ||
/** | ||
* Retruns true if the given node is a {@link TableNode}. | ||
*/ | ||
export declare function $isTableNode(node: LexicalNode | null | undefined): node is TableNode; | ||
export { AdmonitionKind } | ||
/** | ||
* A lexical node that represents the markdown directives (better known as admonitions, thanks to Docusaurus). Use {@link "$createAdmonitionNode"} to construct one. | ||
* | ||
* @remarks | ||
* | ||
* An admonition in markdown looks like this: | ||
* | ||
* ```md | ||
* :::tip | ||
* Some **content** with _Markdown_ `syntax`. Check [this `api`](#). | ||
* ::: | ||
* ``` | ||
*/ | ||
export declare class AdmonitionNode extends ElementNode { | ||
__kind: AdmonitionKind; | ||
static getType(): string; | ||
getKind(): AdmonitionKind; | ||
setKind(kind: AdmonitionKind): void; | ||
static clone(node: AdmonitionNode): AdmonitionNode; | ||
constructor(kind?: AdmonitionKind, key?: NodeKey); | ||
createDOM(config: EditorConfig): HTMLElement; | ||
updateDOM(_prevNode: AdmonitionNode, _dom: HTMLElement): boolean; | ||
static importJSON(serializedNode: SerializedAdmonitionNode): AdmonitionNode; | ||
exportJSON(): SerializedElementNode; | ||
insertNewAfter(_: RangeSelection, restoreSelection?: boolean): AdmonitionNode; | ||
collapseAtStart(): true; | ||
} | ||
declare interface CodeBlockEditorProps extends SandpackEditorProps { | ||
language: string; | ||
} | ||
/** | ||
* A lexical node that represents a fenced code block. Use {@link "$createCodeBlockNode"} to construct one. | ||
*/ | ||
export declare class CodeBlockNode extends DecoratorNode<JSX.Element> { | ||
__code: string; | ||
__meta: string; | ||
__language: string; | ||
__focusEmitter: { | ||
publish: () => void; | ||
subscribe: (cb: () => void) => void; | ||
}; | ||
static getType(): string; | ||
static clone(node: CodeBlockNode): CodeBlockNode; | ||
static importJSON(serializedNode: SerializedCodeBlockNode): CodeBlockNode; | ||
constructor(code: string, language: string, meta: string, key?: NodeKey); | ||
exportJSON(): SerializedCodeBlockNode; | ||
createDOM(_config: EditorConfig): HTMLDivElement; | ||
updateDOM(): false; | ||
getCode(): string; | ||
getMeta(): string; | ||
getLanguage(): string; | ||
setCode(code: string): void; | ||
setMeta(meta: string): void; | ||
setLanguage(language: string): void; | ||
select(): void; | ||
decorate(_editor: LexicalEditor, { theme: { nodeDecoratorComponents: { CodeBlockEditor } } }: ExtendedEditorConfig): JSX.Element; | ||
} | ||
declare type CoordinatesSubscription = (coords: [colIndex: number, rowIndex: number]) => void; | ||
/** | ||
* The options necessary to construct a {@link CodeBlockNode}. | ||
*/ | ||
export declare interface CreateCodeBlockNodeOptions { | ||
/** | ||
* The code contents of the block. | ||
*/ | ||
code: string; | ||
/** | ||
* The additional meta data of the block. | ||
*/ | ||
meta: string; | ||
/** | ||
* The language of the code block (i.e. `js`, `jsx`, etc.). This is used for syntax highlighting. | ||
*/ | ||
language: string; | ||
} | ||
/** | ||
* The payload to create an {@link ImageNode}. | ||
*/ | ||
export declare interface CreateImageNodeOptions { | ||
altText: string; | ||
title?: string; | ||
key?: NodeKey; | ||
src: string; | ||
} | ||
/** | ||
* The payload to create a {@link JsxNode}. | ||
*/ | ||
export declare interface CreateJsxNodeOptions { | ||
/** | ||
* The name of the JSX element. | ||
*/ | ||
name: string; | ||
/** | ||
* The type of the element - markdown makes a distinction between text and flow elements. | ||
*/ | ||
kind: JsxKind; | ||
/** | ||
* The attributes of the JSX element. | ||
*/ | ||
attributes: Array<MdxJsxAttribute>; | ||
/** | ||
* The tree state of the children. | ||
*/ | ||
state?: SerializedEditorState; | ||
/** | ||
* If passed, this function will be called with the root paragraph node of the editor. | ||
*/ | ||
updateFn?: updateFn; | ||
} | ||
/** | ||
* The options necessary to construct a {@link SandpackNode}. | ||
*/ | ||
export declare interface CreateSandpackNodeOptions { | ||
code: string; | ||
meta: string; | ||
language: string; | ||
} | ||
export declare interface CustomLeafDirectiveEditor<T extends LeafDirective> { | ||
testNode: (mdastNode: LeafDirective) => boolean; | ||
Editor: React_2.ComponentType<LeafDirectiveEditorProps<T>>; | ||
} | ||
/** | ||
* The default set of lexical nodes used in the editor. | ||
*/ | ||
declare const defaultLexicalNodes: Record<string, Klass<LexicalNode>>; | ||
/** | ||
* A structure that holds the default values for the options used in the markdown import/export steps. | ||
* | ||
* Most options are exported as records, so that you can pick a specific value using its name rather than its index which can change. | ||
* The actual MDXEditor props accept arrays, so you should use the `Object.values` function to convert the records to arrays. | ||
*/ | ||
export declare type DefaultMdxOptionValues = { | ||
/** The default values for the options used in the import step */ | ||
markdownParse: { | ||
defaultVisitors: Record<string, MdastImportVisitor<Mdast.Content>>; | ||
defaultSyntaxExtensions: Record<string, SyntaxExtension>; | ||
defaultMdastExtensions: Record<string, MdastExtension>; | ||
}; | ||
/** The default values for the options used in the markdown export step */ | ||
lexicalConvert: { | ||
defaultVisitors: Record<string, LexicalExportVisitor<LexicalNode, Mdast.Content>>; | ||
defaultExtensions: Record<string, ToMarkdownExtension_2>; | ||
defaultMarkdownOptions: ToMarkdownOptions_2; | ||
}; | ||
/** The default lexical nodes used by the underlying Lexical framework */ | ||
defaultLexicalNodes: typeof defaultLexicalNodes; | ||
}; | ||
/** | ||
* Exports the default values for the options used in the markdown import/export steps. | ||
*/ | ||
export declare const defaultMdxOptionValues: DefaultMdxOptionValues; | ||
declare interface DialogButtonProps { | ||
autocompleteSuggestions?: string[]; | ||
onSubmit: (value: string) => void; | ||
tooltipTitle: string; | ||
buttonContent?: React_2.ReactNode; | ||
dialogInputPlaceholder: string; | ||
submitButtonTitle: string; | ||
} | ||
declare type ExtendedEditorConfig = EditorConfig & { | ||
theme: EditorConfig['theme'] & { | ||
nodeDecoratorComponents: NodeDecoratorComponents; | ||
}; | ||
}; | ||
declare interface FrontmatterEditorProps { | ||
yaml: string; | ||
onChange: (yaml: string) => void; | ||
} | ||
/** | ||
* Represents {@link https://daily-dev-tips.com/posts/what-exactly-is-frontmatter/ | the frontmatter} of the markdown document. | ||
* Use {@link "$createFrontmatterNode"} to construct one. | ||
*/ | ||
export declare class FrontmatterNode extends DecoratorNode<JSX.Element> { | ||
__yaml: string; | ||
static getType(): string; | ||
static clone(node: FrontmatterNode): FrontmatterNode; | ||
static importJSON(serializedNode: SerializedFrontmatterNode): FrontmatterNode; | ||
constructor(code: string, key?: NodeKey); | ||
exportJSON(): SerializedFrontmatterNode; | ||
createDOM(_config: EditorConfig): HTMLDivElement; | ||
updateDOM(): false; | ||
getYaml(): string; | ||
setYaml(yaml: string): void; | ||
decorate(editor: LexicalEditor, { theme: { nodeDecoratorComponents: { FrontmatterEditor } } }: ExtendedEditorConfig): JSX.Element; | ||
} | ||
declare interface ImageEditorProps { | ||
nodeKey: string; | ||
src: string; | ||
title?: string; | ||
} | ||
/** | ||
* A lexical node that represents an image. Use {@link "$createImageNode"} to construct one. | ||
*/ | ||
export declare class ImageNode extends DecoratorNode<JSX.Element> { | ||
__src: string; | ||
__altText: string; | ||
__title: string | undefined; | ||
static getType(): string; | ||
static clone(node: ImageNode): ImageNode; | ||
static importJSON(serializedNode: SerializedImageNode): ImageNode; | ||
exportDOM(): DOMExportOutput; | ||
static importDOM(): DOMConversionMap | null; | ||
constructor(src: string, altText: string, title: string | undefined, key?: NodeKey); | ||
exportJSON(): SerializedImageNode; | ||
createDOM(config: EditorConfig): HTMLElement; | ||
updateDOM(): false; | ||
getSrc(): string; | ||
getAltText(): string; | ||
getTitle(): string | undefined; | ||
setTitle(title: string | undefined): void; | ||
decorate(_parentEditor: LexicalEditor, { theme: { nodeDecoratorComponents: { ImageEditor } } }: ExtendedEditorConfig): JSX.Element; | ||
} | ||
declare const IS_BOLD: 1; | ||
declare const IS_ITALIC: 2; | ||
declare const IS_UNDERLINE: 8; | ||
/** | ||
* Defines the structure of a JSX component that can be used within the markdown document. | ||
*/ | ||
export declare interface JsxComponentDescriptor { | ||
/** | ||
* The tag name | ||
*/ | ||
name: string; | ||
/** | ||
* Wether the component is a flow or text component (inline or block) | ||
*/ | ||
kind: 'flow' | 'text'; | ||
/** | ||
* The module path from which the component can be imported | ||
*/ | ||
source: string; | ||
/** | ||
* Wether the component is the default export of the module | ||
*/ | ||
defaultExport?: boolean; | ||
/** | ||
* The properties that can be applied to the component | ||
*/ | ||
props: Array<JsxPropertyDescriptor>; | ||
} | ||
declare interface JsxEditorProps { | ||
kind: JsxKind; | ||
attributes: MdxJsxAttribute[]; | ||
componentName: string; | ||
onSubmit: (values: Record<string, string>) => void; | ||
theme: EditorThemeClasses; | ||
editor: LexicalEditor; | ||
} | ||
declare type JsxKind = 'text' | 'flow'; | ||
/** | ||
* A lexical node that represents a JSX element. Use {@link "$createJsxNode"} to construct one. | ||
*/ | ||
export declare class JsxNode extends DecoratorNode<JSX.Element> { | ||
__kind: JsxKind; | ||
__name: string; | ||
__attributes: Array<MdxJsxAttribute>; | ||
__editor: LexicalEditor; | ||
static getType(): string; | ||
static clone(node: JsxNode): JsxNode; | ||
static importJSON(serializedNode: SerializedJsxNode): JsxNode; | ||
constructor({ name, kind, attributes, state, updateFn, key }: JsxNodeConstructorParams); | ||
exportJSON(): SerializedJsxNode; | ||
inNestedEditor(callback: () => void): void; | ||
getChildren(): Array<LexicalNode>; | ||
createDOM(): HTMLElement; | ||
updateDOM(): false; | ||
getName(): string; | ||
getKind(): JsxKind; | ||
getAttributes(): MdxJsxAttribute[]; | ||
updateAttributes(attributeValues: Record<string, string>): void; | ||
decorate(_parentEditor: LexicalEditor, { theme: { nodeDecoratorComponents: { JsxEditor } } }: ExtendedEditorConfig): JSX.Element; | ||
} | ||
/** | ||
* The parameters of the {@link JsxNode} constructor. | ||
*/ | ||
export declare interface JsxNodeConstructorParams extends CreateJsxNodeOptions { | ||
key?: NodeKey; | ||
} | ||
/** | ||
* Defines the structure of a JSX component property. | ||
*/ | ||
export declare interface JsxPropertyDescriptor { | ||
/** | ||
* The name of the property | ||
*/ | ||
name: string; | ||
/** | ||
* The type of the property | ||
*/ | ||
type: 'string' | 'number'; | ||
/** | ||
* Wether the property is required | ||
*/ | ||
required?: boolean; | ||
} | ||
export declare interface LeafDirectiveEditorProps<T extends LeafDirective> { | ||
/** The Lexical editor that contains the node */ | ||
parentEditor: LexicalEditor; | ||
/** The Lexical node that is being edited */ | ||
leafDirective: LeafDirectiveNode; | ||
/** The MDAST node that is being edited */ | ||
mdastNode: T; | ||
} | ||
/** | ||
* A lexical node that represents an image. Use {@link "$createLeafDirectiveNode"} to construct one. | ||
*/ | ||
export declare class LeafDirectiveNode extends DecoratorNode<JSX.Element> { | ||
__mdastNode: LeafDirective; | ||
static getType(): string; | ||
static clone(node: LeafDirectiveNode): LeafDirectiveNode; | ||
static importJSON(serializedNode: SerializedLeafDirectiveNode): LeafDirectiveNode; | ||
constructor(mdastNode: LeafDirective, key?: NodeKey); | ||
getMdastNode(): LeafDirective; | ||
exportJSON(): SerializedLeafDirectiveNode; | ||
createDOM(): HTMLElement; | ||
updateDOM(): false; | ||
setMdastNode(mdastNode: LeafDirective): void; | ||
decorate(parentEditor: LexicalEditor, { theme: { nodeDecoratorComponents: { LeafDirectiveEditor } } }: ExtendedEditorConfig): JSX.Element; | ||
isInline(): boolean; | ||
isKeyboardSelectable(): boolean; | ||
} | ||
/** | ||
* Configures how the lexical tree is converted to a mdast tree and then to markdown. | ||
*/ | ||
export declare interface LexicalConvertOptions { | ||
/** | ||
* The visitors to use when processing the lexical tree | ||
*/ | ||
visitors?: LexicalVisitor[]; | ||
/** | ||
* the markdown extensions to use | ||
*/ | ||
toMarkdownExtensions?: Array<ToMarkdownExtension>; | ||
/** | ||
* The options to pass to `toMarkdown` | ||
*/ | ||
toMarkdownOptions?: ToMarkdownOptions; | ||
} | ||
/** | ||
* Implement this interface in order to process mdast node(s) into a lexical tree. | ||
* This is part of the process that converts the editor contents to markdown. | ||
*/ | ||
export declare interface LexicalExportVisitor<LN extends LexicalNode, UN extends Mdast.Content> { | ||
/** | ||
* Return true if the given node is of the type that this visitor can process. | ||
* You can safely use the node type guard functions (as in $isParagraphNode, $isLinkNode, etc.) here. | ||
*/ | ||
testLexicalNode?(lexicalNode: LexicalNode): lexicalNode is LN; | ||
/** | ||
* Process the given node and manipulate the mdast tree accordingly. | ||
* @see {@link LexicalNodeVisitParams} and {@link LexicalVisitActions} for more information. | ||
*/ | ||
visitLexicalNode?(params: LexicalNodeVisitParams<LN>): void; | ||
/** | ||
* Return true if the current node should be joined with the previous node. | ||
* This is necessary due to some inconsistencies between the lexical tree and the mdast tree when it comes to formatting. | ||
*/ | ||
shouldJoin?(prevNode: Mdast.Content, currentNode: UN): boolean; | ||
/** | ||
* Join the current node with the previous node, returning the resulting new node | ||
* For this to be called by the tree walk, shouldJoin must return true. | ||
*/ | ||
join?<T extends Mdast.Content>(prevNode: T, currentNode: T): T; | ||
} | ||
/** | ||
* The params passed to the {@link LexicalExportVisitor.visitLexicalNode} method. | ||
*/ | ||
export declare interface LexicalNodeVisitParams<T extends LexicalNode> { | ||
/** | ||
* The lexical node that is being visited. | ||
*/ | ||
lexicalNode: T; | ||
/** | ||
* The mdast parent node that the result of the lexical node conversion should be appended to. | ||
*/ | ||
mdastParent: Mdast.Parent; | ||
/** | ||
* A set of actions that can be used to manipulate the mdast tree. | ||
* These are "convenience" utilities that avoid the repetitive boilerplate of creating mdast nodes. | ||
*/ | ||
actions: LexicalVisitActions<T>; | ||
} | ||
/** | ||
* A set of covenience utilities to manipulate the mdast tree when processing lexical nodes. | ||
*/ | ||
export declare interface LexicalVisitActions<T extends LexicalNode> { | ||
/** | ||
* Iterate over the immediate children of a lexical node with the given mdast node as a parent. | ||
*/ | ||
visitChildren(node: T, mdastParent: Mdast.Parent): void; | ||
/** | ||
* Create a new mdast node with the given type, and props. | ||
* Iterate over the immediate children of the current lexical node with the new mdast node as a parent. | ||
* @param hasChildren - true by default. Pass false to skip iterating over the lexical node children. | ||
*/ | ||
addAndStepInto(type: string, props?: Record<string, unknown>, hasChildren?: boolean): void; | ||
/** | ||
* Append a new mdast node to a parent node. | ||
* @param parentNode - the mdast parent node to append the new node to. | ||
* @param node - the mdast node to append. | ||
*/ | ||
appendToParent<T extends Mdast.Parent>(parentNode: T, node: T['children'][number]): T['children'][number] | Mdast.Root; | ||
/** | ||
* Used when processing JSX nodes so that later, the correct import statement can be added to the document. | ||
* @param componentName - the name of the component that has to be imported. | ||
* @see {@link JsxComponentDescriptor} | ||
*/ | ||
registerReferredComponent(componentName: string): void; | ||
} | ||
declare type LexicalVisitor = LexicalExportVisitor<LexicalNode, Mdast.Content>; | ||
/** | ||
* Options that control how the the markdown input string is parsed into a tree. | ||
* @see {@link https://github.com/syntax-tree/mdast-util-from-markdown | fromMarkdown} | ||
*/ | ||
export declare interface MarkdownParseOptions { | ||
/** | ||
* The visitors to process the markdown AST with. | ||
*/ | ||
visitors?: MdastImportVisitor<Mdast.Content>[]; | ||
/** | ||
* The extensions to use for the markdown parser. Passed as the `extensions` option to the `fromMarkdown` function. | ||
*/ | ||
syntaxExtensions?: NonNullable<ParseOptions['extensions']>; | ||
/** | ||
* The mdast extensions to use for the markdown parser. Passed as the `mdastExtensions` option to the `fromMarkdown` function. | ||
*/ | ||
mdastExtensions?: NonNullable<FromMarkdownOptions['mdastExtensions']>; | ||
} | ||
declare interface MarkdownParseOptions_2 extends Omit<MdastTreeImportOptions, 'mdastRoot'> { | ||
markdown: string; | ||
syntaxExtensions: NonNullable<ParseOptions['extensions']>; | ||
mdastExtensions: NonNullable<FromMarkdownOptions['mdastExtensions']>; | ||
} | ||
/** | ||
* An extension for the `fromMarkdown` utility tree construction. | ||
*/ | ||
declare type MdastExtension = MarkdownParseOptions_2['mdastExtensions'][number]; | ||
/** | ||
* Implement this interface to convert certian mdast nodes into lexical nodes. | ||
* @typeParam UN - The type of the mdast node that is being visited. | ||
*/ | ||
export declare interface MdastImportVisitor<UN extends Mdast.Content> { | ||
/** | ||
* The test function that determines if this visitor should be used for the given node. | ||
* As a convenience, you can also pass a string here, which will be compared to the node's type. | ||
*/ | ||
testNode: ((mdastNode: Mdast.Content | Mdast.Root) => boolean) | string; | ||
/** | ||
* The function that is called when the node is visited. See {@link MdastVisitParams} for details. | ||
*/ | ||
visitNode(params: MdastVisitParams<UN>): void; | ||
} | ||
/** | ||
* The options of the tree import utility. Not meant to be used directly. | ||
*/ | ||
export declare interface MdastTreeImportOptions { | ||
root: RootNode; | ||
visitors: Array<MdastImportVisitor<Mdast.Content>>; | ||
mdastRoot: Mdast.Root; | ||
} | ||
/** | ||
* A set of actions that can be used to modify the lexical tree while visiting the mdast tree. | ||
*/ | ||
export declare interface MdastVisitActions { | ||
/** | ||
* Iterate the children of the node with the lexical node as the parent. | ||
*/ | ||
visitChildren(node: Mdast.Parent, lexicalParent: LexicalNode): void; | ||
/** | ||
* Add the given node to the lexical tree, and iterate the current mdast node's children with the newly created lexical node as a parent. | ||
*/ | ||
addAndStepInto(lexicalNode: LexicalNode): void; | ||
/** | ||
* Adds formatting as a context for the current node and its children. | ||
* This is necessary due to mdast treating formatting as a node, while lexical considering it an attribute of a node. | ||
*/ | ||
addFormatting(format: typeof IS_BOLD | typeof IS_ITALIC | typeof IS_UNDERLINE): void; | ||
/** | ||
* Access the current formatting context. | ||
*/ | ||
getParentFormatting(): number; | ||
} | ||
/** | ||
* Parameters passe to the {@link MdastImportVisitor.visitNode} function. | ||
* @param mdastNode - The node that is currently being visited. | ||
* @param lexicalParent - The parent lexical node to which the results of the processing should be added. | ||
* @param actions - A set of convenience utilities that can be used to add nodes to the lexical tree. | ||
* @typeParam T - The type of the mdast node that is being visited. | ||
*/ | ||
export declare interface MdastVisitParams<T extends Mdast.Content> { | ||
mdastNode: T; | ||
lexicalParent: LexicalNode; | ||
actions: MdastVisitActions; | ||
} | ||
/** | ||
* The MDXEditor React component. See {@link MDXEditorProps} for the list of available props and the {@link MDXEditorMethods} for the methods exposed through the ref. | ||
*/ | ||
export declare const MDXEditor: React_2.ForwardRefExoticComponent<MDXEditorProps & React_2.RefAttributes<MDXEditorMethods>>; | ||
/** | ||
* The interface for the {@link MDXEditor} object reference. | ||
* | ||
* @example | ||
* ```tsx | ||
* const mdxEditorRef = React.useRef<MDXEditorMethods>(null) | ||
* <MDXEditor ref={mdxEditorRef} /> | ||
* ``` | ||
*/ | ||
export declare interface MDXEditorMethods { | ||
/** | ||
* Gets the current markdown value. | ||
*/ | ||
getMarkdown: () => string; | ||
/** | ||
* Updates the markdown value of the editor. | ||
*/ | ||
setMarkdown: (value: string) => void; | ||
} | ||
/** | ||
* The properties of the {@link MDXEditor} react component | ||
*/ | ||
export declare interface MDXEditorProps { | ||
/** | ||
* The markdown content to be edited. | ||
* Notice: this is the initial value of the editor. | ||
* If you want to change the value of the editor, use the `setMarkdown` method. | ||
*/ | ||
markdown: string; | ||
/** | ||
* The configuration for the sandpack editor that's used for the fenced code blocks. | ||
* @see the {@link SandpackConfig} interface for more details. | ||
*/ | ||
sandpackConfig?: SandpackConfig; | ||
/** | ||
* The markdown content to use for the diff view mode. If not provided, the contents of the `markdown` prop will be used. | ||
*/ | ||
headMarkdown?: string; | ||
/** | ||
* The configuration for the JSX components used in the markdown content. | ||
* @see the {@link JsxComponentDescriptor} interface for more details. | ||
*/ | ||
jsxComponentDescriptors?: JsxComponentDescriptor[]; | ||
/** | ||
* The list of suggestions to be shown in the link autocomplete dialog dropdown. | ||
*/ | ||
linkAutocompleteSuggestions?: string[]; | ||
/** | ||
* The list of suggestions to be shown in the image autocomplete dialog dropdown. | ||
*/ | ||
imageAutoCompleteSuggestions?: string[]; | ||
/** | ||
* The set of components to be rendered in the toolbar. | ||
*/ | ||
toolbarComponents?: React_2.ComponentType[]; | ||
/** | ||
* The initial view mode for the editor. Defaults to `ViewMode.editor`. | ||
*/ | ||
viewMode?: ViewMode; | ||
/** | ||
* Triggered when the markdown content changes. | ||
*/ | ||
onChange?: (markdown: string) => void; | ||
/** | ||
* The CSS class name to be applied to the wrapper element of the component. | ||
*/ | ||
className?: string; | ||
/** | ||
* The CSS class name to be applied to the content editable element. | ||
*/ | ||
contentEditableClassName?: string; | ||
/** | ||
* The options to be used when parsing the markdown content. | ||
* @see the {@link MarkdownParseOptions} interface for more details. | ||
*/ | ||
markdownParseOptions?: MarkdownParseOptions; | ||
/** | ||
* The {@link https://lexical.dev/ | Lexical nodes} used by the editor. | ||
*/ | ||
lexicalNodes?: Klass<LexicalNode>[]; | ||
/** | ||
* The options used when converting the lexical tree to markdown. | ||
* @see the {@link LexicalConvertOptions} interface for more details. | ||
*/ | ||
lexicalConvertOptions?: LexicalConvertOptions; | ||
/** | ||
* The supported code block languages. | ||
*/ | ||
codeBlockLanguages?: Record<string, string>; | ||
/** | ||
* Implement this so that users can drag and drop or paste images into the editor. | ||
* Pass an implementation that takes a file as an argument, and returns Promise<string>, where string is the url of the image to be inserted. | ||
* @example | ||
* ``` | ||
*async function imageUploadHandler(image: File) { | ||
* const formData = new FormData() | ||
* formData.append('image', image) | ||
* const response = await fetch('/uploads/new', { method: 'POST', body: formData }) | ||
* const json = (await response.json()) as { url: string } | ||
* return json.url | ||
*} | ||
* ``` | ||
*/ | ||
imageUploadHandler?: (image: File) => Promise<string>; | ||
customLeafDirectiveEditors?: CustomLeafDirectiveEditor<any>[]; | ||
} | ||
/** | ||
* A nested editor React component that allows editing of the contents of complex markdown nodes that have nested markdown content (for example, custom directives or JSX elements). See the {@link NestedEditorProps} for more details on the compoment props. | ||
* | ||
* @example | ||
* You can use a type param to specify the type of the mdast node | ||
* | ||
* ```tsx | ||
* | ||
* interface CalloutDirectiveNode extends LeafDirective { | ||
* name: 'callout' | ||
* children: Mdast.PhrasingContent[] | ||
* } | ||
* | ||
* return <NestedEditor<CalloutDirectiveNode> getContent={node => node.children} getUpdatedMdastNode={(node, children) => ({ ...node, children })} /> | ||
* ``` | ||
*/ | ||
export declare const NestedEditor: <T extends Mdast.Content>(props: NestedEditorProps<T>) => React_2.JSX.Element; | ||
/** | ||
* The properties of the {@link NestedEditor} React Component. | ||
* @typeParam T - The type of the mdast node of the editor. | ||
*/ | ||
export declare interface NestedEditorProps<T extends Mdast.Content> { | ||
/** | ||
* A function that returns the phrasing content of the mdast node. In most cases, this will be the `children` property of the mdast node, but you can also have multiple nested nodes with their own children. | ||
*/ | ||
getContent: (mdastNode: T) => Mdast.PhrasingContent[]; | ||
/** | ||
* A function that should return the updated mdast node based on the original mdast node and the new content (serialized as mdast tree) produced by the editor. | ||
*/ | ||
getUpdatedMdastNode: (mdastNode: T, children: Mdast.PhrasingContent[]) => T; | ||
/** | ||
* Props passed to the {@link https://github.com/facebook/lexical/blob/main/packages/lexical-react/src/LexicalContentEditable.tsx | ContentEditable} component. | ||
*/ | ||
contentEditableProps?: React_2.ComponentProps<typeof ContentEditable>; | ||
} | ||
declare interface NodeDecoratorComponents { | ||
FrontmatterEditor: React.FC<FrontmatterEditorProps>; | ||
JsxEditor: React.FC<JsxEditorProps>; | ||
SandpackEditor: React.FC<SandpackEditorProps>; | ||
CodeBlockEditor: React.FC<CodeBlockEditorProps>; | ||
TableEditor: React.FC<TableEditorProps>; | ||
ImageEditor: React.FC<ImageEditorProps>; | ||
LeafDirectiveEditor: React.FC<LeafDirectiveEditorProps<LeafDirective>>; | ||
} | ||
/** | ||
* The configuration for the available sandpack presets. | ||
*/ | ||
export declare interface SandpackConfig { | ||
/** | ||
* The name of the default preset that will be used if no meta (other than live) is set. | ||
*/ | ||
defaultPreset: string; | ||
/** | ||
* The list of sandpack presets that can be used. | ||
*/ | ||
presets: Array<SandpackPreset>; | ||
} | ||
declare interface SandpackEditorProps { | ||
code: string; | ||
nodeKey: string; | ||
meta: string; | ||
onChange: (code: string) => void; | ||
focusEmitter: VoidEmitter; | ||
} | ||
/** | ||
* A lexical node that represents a live code block that gets a preview. Use {@link "$createSandpackNode"} to construct one. | ||
*/ | ||
export declare class SandpackNode extends DecoratorNode<JSX.Element> { | ||
__code: string; | ||
__meta: string; | ||
__language: string; | ||
__focusEmitter: { | ||
publish: () => void; | ||
subscribe: (cb: () => void) => void; | ||
}; | ||
static getType(): string; | ||
static clone(node: SandpackNode): SandpackNode; | ||
static importJSON(serializedNode: SerializedSandpackNode): SandpackNode; | ||
constructor(code: string, language: string, meta: string, key?: NodeKey); | ||
exportJSON(): SerializedSandpackNode; | ||
createDOM(_config: EditorConfig): HTMLDivElement; | ||
updateDOM(): false; | ||
getCode(): string; | ||
getMeta(): string; | ||
getLanguage(): string; | ||
setCode(code: string): void; | ||
setMeta(meta: string): void; | ||
setLanguage(language: string): void; | ||
select(): void; | ||
decorate(_parentEditor: LexicalEditor, { theme: { nodeDecoratorComponents: { SandpackEditor } } }: ExtendedEditorConfig): JSX.Element; | ||
} | ||
/** | ||
* Defines a single preset that can be used to create a sandbox. | ||
*/ | ||
export declare interface SandpackPreset { | ||
/** | ||
* The name of the preset - use this to reference the preset from the defaultPreset field. | ||
*/ | ||
name: string; | ||
/** | ||
* The label of the preset, displayed in the sandpack button dropdown. | ||
*/ | ||
label: string; | ||
/** | ||
* The meta string that will be used to identify the preset from the fenced code block. e.g. "live react" | ||
*/ | ||
meta: string; | ||
/** | ||
* The sandpack template that will be used to create the sandbox. e.g. "react", "react-ts", "vanilla". | ||
*/ | ||
sandpackTemplate: SandpackProviderProps['template']; | ||
/** | ||
* The sandpack theme that will be used to create the sandbox. e.g. "light", "dark". | ||
*/ | ||
sandpackTheme: SandpackProviderProps['theme']; | ||
/** | ||
* The name of the file that will be created in the sandbox. e.g. "/App.js". | ||
*/ | ||
snippetFileName: string; | ||
/** | ||
* The dependencies that will be added to the sandbox, just like in package.json. | ||
*/ | ||
dependencies?: Record<string, string>; | ||
/** | ||
* The files that will be added to the sandbox (read-only). | ||
* The key is the name of the file, and the value is the contents of the file. | ||
*/ | ||
files?: Record<string, string>; | ||
/** | ||
* The language used in the editable snippet. e.g. "jsx", "tsx", etc. | ||
*/ | ||
snippetLanguage?: string; | ||
/** | ||
* The initial content of the editable snippet. | ||
*/ | ||
initialSnippetContent?: string; | ||
} | ||
declare type SandpackProviderProps = React_2.ComponentProps<typeof SandpackProvider>; | ||
/** | ||
* A serialized representation of an {@link AdmonitionNode}. | ||
*/ | ||
export declare type SerializedAdmonitionNode = Spread<{ | ||
type: 'admonition'; | ||
kind: AdmonitionKind; | ||
version: 1; | ||
}, SerializedElementNode>; | ||
/** | ||
* A serialized representation of an {@link CodeBlockNode}. | ||
*/ | ||
export declare type SerializedCodeBlockNode = Spread<CreateCodeBlockNodeOptions & { | ||
type: 'codeblock'; | ||
version: 1; | ||
}, SerializedLexicalNode>; | ||
/** | ||
* A serialized representation of an {@link FrontmatterNode}. | ||
*/ | ||
export declare type SerializedFrontmatterNode = Spread<{ | ||
yaml: string; | ||
version: 1; | ||
}, SerializedLexicalNode>; | ||
/** | ||
* A serialized representation of an {@link ImageNode}. | ||
*/ | ||
export declare type SerializedImageNode = Spread<{ | ||
altText: string; | ||
title?: string; | ||
src: string; | ||
type: 'image'; | ||
version: 1; | ||
}, SerializedLexicalNode>; | ||
/** | ||
* A serialized representation of a {@link JsxNode}. | ||
*/ | ||
export declare type SerializedJsxNode = Spread<Omit<CreateJsxNodeOptions, 'updateFn'> & { | ||
version: 1; | ||
type: 'jsx'; | ||
}, SerializedLexicalNode>; | ||
/** | ||
* A serialized representation of an {@link LeafDirectiveNode}. | ||
*/ | ||
export declare type SerializedLeafDirectiveNode = Spread<{ | ||
mdastNode: LeafDirective; | ||
type: 'leafDirective'; | ||
version: 1; | ||
}, SerializedLexicalNode>; | ||
/** | ||
* A serialized representation of an {@link SandpackNode}. | ||
*/ | ||
export declare type SerializedSandpackNode = Spread<CreateSandpackNodeOptions & { | ||
type: 'sandpack'; | ||
version: 1; | ||
}, SerializedLexicalNode>; | ||
/** | ||
* A serialized representation of a {@link TableNode}. | ||
*/ | ||
export declare type SerializedTableNode = Spread<{ | ||
mdastNode: Mdast.Table; | ||
}, SerializedLexicalNode>; | ||
/** | ||
* An extension for the `fromMarkdown` utility markdown parse. | ||
*/ | ||
declare type SyntaxExtension = MarkdownParseOptions_2['syntaxExtensions'][number]; | ||
declare interface TableEditorProps { | ||
parentEditor: LexicalEditor; | ||
lexicalTable: TableNode; | ||
mdastNode: Mdast.Table; | ||
} | ||
/** | ||
* A lexical node that represents a table, with features specific to the markdown tables. | ||
* Use {@link "$createTableNode"} to construct one. | ||
*/ | ||
export declare class TableNode extends DecoratorNode<JSX.Element> { | ||
__mdastNode: Mdast.Table; | ||
focusEmitter: { | ||
publish: (coords: [colIndex: number, rowIndex: number]) => void; | ||
subscribe: (cb: CoordinatesSubscription) => void; | ||
}; | ||
static getType(): string; | ||
static clone(node: TableNode): TableNode; | ||
static importJSON(serializedNode: SerializedTableNode): TableNode; | ||
exportJSON(): SerializedTableNode; | ||
getMdastNode(): Mdast.Table; | ||
getRowCount(): number; | ||
getColCount(): number; | ||
constructor(mdastNode?: Mdast.Table, key?: NodeKey); | ||
createDOM(): HTMLElement; | ||
updateDOM(): false; | ||
updateCellContents(colIndex: number, rowIndex: number, children: Mdast.PhrasingContent[]): void; | ||
insertColumnAt(colIndex: number): void; | ||
deleteColumnAt(colIndex: number): void; | ||
insertRowAt(y: number): void; | ||
deleteRowAt(rowIndex: number): void; | ||
addRowToBottom(): void; | ||
addColumnToRight(): void; | ||
setColumnAlign(colIndex: number, align: Mdast.AlignType): void; | ||
decorate(parentEditor: LexicalEditor, { theme: { nodeDecoratorComponents: { TableEditor } } }: ExtendedEditorConfig): JSX.Element; | ||
select(coords: [colIndex: number, rowIndex: number]): void; | ||
isInline(): false; | ||
} | ||
declare type ToMarkdownExtension = NonNullable<ToMarkdownOptions['extensions']>[number]; | ||
export { ToMarkdownOptions } | ||
/** | ||
* A dictionary with all built-in Toolbar components that can be used within the toolbar. | ||
* @see To customize the toolbar, pass an array of what you need to the {@link MDXEditorProps.toolbarComponents}. | ||
*/ | ||
export declare const ToolbarComponents: { | ||
BlockTypeSelect: () => React_2.JSX.Element; | ||
BoldItalicUnderlineButtons: React_2.FC<{}>; | ||
CodeBlockButton: React_2.FC<{}>; | ||
CodeFormattingButton: React_2.FC<{}>; | ||
FrontmatterButton: React_2.FC<{}>; | ||
GroupGroup: React_2.FC<{ | ||
children: React_2.ReactNode; | ||
}>; | ||
HorizontalRuleButton: React_2.FC<{}>; | ||
LinkButton: React_2.FC<{}>; | ||
ListButtons: React_2.FC<{}>; | ||
SandpackButton: React_2.FC<{}>; | ||
TableButton: React_2.FC<{}>; | ||
ToggleItem: React_2.ForwardRefExoticComponent<RadixToolbar.ToolbarToggleItemProps & { | ||
title: string; | ||
} & React_2.RefAttributes<HTMLButtonElement>>; | ||
ToggleSingleGroup: React_2.ForwardRefExoticComponent<Omit<RadixToolbar.ToolbarToggleGroupSingleProps, "type"> & React_2.RefAttributes<HTMLDivElement>>; | ||
ToggleSingleGroupWithItem: React_2.ForwardRefExoticComponent<Omit<RadixToolbar.ToolbarToggleGroupSingleProps, "type"> & { | ||
on: boolean; | ||
title: string; | ||
} & React_2.RefAttributes<HTMLDivElement>>; | ||
ToolbarButton: React_2.ForwardRefExoticComponent<RadixToolbar.ToolbarButtonProps & { | ||
title: string; | ||
} & React_2.RefAttributes<HTMLButtonElement>>; | ||
ToolbarSeparator: React_2.ForwardRefExoticComponent<RadixToolbar.ToolbarSeparatorProps & React_2.RefAttributes<HTMLDivElement>>; | ||
ImageButton: React_2.ForwardRefExoticComponent<Omit<Record<string, never>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>; | ||
DialogButton: React_2.ForwardRefExoticComponent<DialogButtonProps & React_2.RefAttributes<HTMLButtonElement>>; | ||
}; | ||
export declare type updateFn = (node: LexicalNode) => void; | ||
/** | ||
* A hook that returns a function that can be used to update the mdast node. Use this in your custom editor components. | ||
*/ | ||
export declare function useMdastNodeUpdater<T extends Mdast.Content>(): (node: T) => void; | ||
/** | ||
* The editor view mode. | ||
* editor - The default rich text view mode. | ||
* markdown - plain text markdown edit mode. | ||
* diff - side by side comparison with the original markdown (passed as `headMarkdown`). | ||
*/ | ||
declare type ViewMode = 'editor' | 'markdown' | 'diff'; | ||
declare interface VoidEmitter { | ||
publish: () => void; | ||
subscribe: (callback: () => void) => void; | ||
} | ||
export { } | ||
export * from './MDXEditor'; | ||
export * from './plugins/headings'; | ||
export * from './plugins/thematic-break'; | ||
export * from './plugins/lists'; | ||
export * from './plugins/table'; | ||
export * from './plugins/link'; | ||
export * from './plugins/image'; | ||
export * from './plugins/frontmatter'; | ||
export * from './plugins/quote'; | ||
export * from './plugins/jsx'; | ||
export * from './jsx-editors/GenericJsxEditor'; | ||
export * from './plugins/sandpack'; | ||
export * from './plugins/codemirror'; | ||
export * from './plugins/codeblock'; | ||
export * from './plugins/directives'; | ||
export * from './directive-editors/AdmonitionDirectiveDescriptor'; | ||
export * from './directive-editors/GenericDirectiveEditor'; | ||
export * from './plugins/link-dialog'; | ||
export * from './plugins/toolbar'; | ||
export * from './plugins/diff-source'; | ||
export * from './plugins/markdown-shortcut'; | ||
export * from './plugins/toolbar/components/BlockTypeSelect'; | ||
export * from './plugins/toolbar/components/BoldItalicUnderlineToggles'; | ||
export * from './plugins/toolbar/components/ChangeAdmonitionType'; | ||
export * from './plugins/toolbar/components/ChangeCodeMirrorLanguage'; | ||
export * from './plugins/toolbar/components/CodeToggle'; | ||
export * from './plugins/toolbar/components/CreateLink'; | ||
export * from './plugins/toolbar/components/DiffSourceToggleWrapper'; | ||
export * from './plugins/toolbar/components/InsertAdmonition'; | ||
export * from './plugins/toolbar/components/InsertCodeBlock'; | ||
export * from './plugins/toolbar/components/InsertFrontmatter'; | ||
export * from './plugins/toolbar/components/InsertImage'; | ||
export * from './plugins/toolbar/components/InsertSandpack'; | ||
export * from './plugins/toolbar/components/InsertTable'; | ||
export * from './plugins/toolbar/components/InsertThematicBreak'; | ||
export * from './plugins/toolbar/components/ListsToggle'; | ||
export * from './plugins/toolbar/components/ShowSandpackInfo'; | ||
export * from './plugins/toolbar/components/UndoRedo'; | ||
export * from './plugins/toolbar/components/KitchenSinkToolbar'; | ||
export * from './plugins/toolbar/primitives/toolbar'; | ||
export * from './plugins/toolbar/primitives/DialogButton'; | ||
export * from './plugins/toolbar/primitives/TooltipWrap'; | ||
export * from './plugins/toolbar/primitives/select'; |
@@ -1,74 +0,135 @@ | ||
import { d, g, j, l, m, x, p, w, f, h, k, $, n, y, q, v, A, C, F, I, J, L, M, b, o, r, T, z, c } from "./index-ce0832cc.js"; | ||
import { AdmonitionKind } from "lexical"; | ||
import "@lexical/react/LexicalComposer"; | ||
import "@lexical/react/LexicalContentEditable"; | ||
import "@lexical/react/LexicalErrorBoundary"; | ||
import "@lexical/react/LexicalHorizontalRulePlugin"; | ||
import "@lexical/react/LexicalLinkPlugin"; | ||
import "@lexical/react/LexicalListPlugin"; | ||
import "@lexical/react/LexicalRichTextPlugin"; | ||
import "@lexical/react/LexicalTabIndentationPlugin"; | ||
import "classnames"; | ||
import "react"; | ||
import "@lexical/code"; | ||
import "@lexical/link"; | ||
import "@lexical/list"; | ||
import "@lexical/react/LexicalHorizontalRuleNode"; | ||
import "@lexical/rich-text"; | ||
import "mdast-util-directive"; | ||
import "mdast-util-from-markdown"; | ||
import "mdast-util-frontmatter"; | ||
import "mdast-util-gfm-table"; | ||
import "mdast-util-mdx"; | ||
import "micromark-extension-directive"; | ||
import "micromark-extension-frontmatter"; | ||
import "micromark-extension-gfm-table"; | ||
import "micromark-extension-mdxjs"; | ||
import "@lexical/utils"; | ||
import "@lexical/react/LexicalComposerContext"; | ||
import "@lexical/selection"; | ||
import "@lexical/react/LexicalHistoryPlugin"; | ||
import "mdast-util-to-markdown"; | ||
import "@radix-ui/react-popover"; | ||
import "@radix-ui/react-tooltip"; | ||
import "downshift"; | ||
import "@lexical/markdown"; | ||
import "@lexical/react/LexicalMarkdownShortcutPlugin"; | ||
import "react-diff-view"; | ||
import "unidiff"; | ||
import "@radix-ui/react-toolbar"; | ||
import "@radix-ui/react-select"; | ||
import "@radix-ui/react-dialog"; | ||
import "@lexical/react/LexicalNestedComposer"; | ||
import "./styles/globals.css.js"; | ||
import { MDXEditor } from "./MDXEditor.js"; | ||
import { headingsPlugin, headingsSystem } from "./plugins/headings/index.js"; | ||
import { thematicBreakPlugin, thematicBreakPluginHooks, thematicBreakSystem } from "./plugins/thematic-break/index.js"; | ||
import { listsPlugin, listsPluginHooks, listsSystem } from "./plugins/lists/index.js"; | ||
import { tablePlugin, tablePluginHooks, tableSystem } from "./plugins/table/index.js"; | ||
import { linkPlugin, linkSystem } from "./plugins/link/index.js"; | ||
import { INSERT_IMAGE_COMMAND, imagePlugin, imagePluginHooks, imageSystem } from "./plugins/image/index.js"; | ||
import { frontmatterPlugin, frontmatterPluginHooks, frontmatterSystem } from "./plugins/frontmatter/index.js"; | ||
import { quotePlugin, quotePluginHooks } from "./plugins/quote/index.js"; | ||
import { jsxPlugin, jsxPluginHooks, jsxSystem } from "./plugins/jsx/index.js"; | ||
import { GenericJsxEditor } from "./jsx-editors/GenericJsxEditor.js"; | ||
import { sandpackPlugin, sandpackPluginHooks, sandpackSystem } from "./plugins/sandpack/index.js"; | ||
import { codeMirrorHooks, codeMirrorPlugin, codeMirrorSystem } from "./plugins/codemirror/index.js"; | ||
import { codeBlockPlugin, codeBlockPluginHooks, codeBlockSystem } from "./plugins/codeblock/index.js"; | ||
import { directivesPlugin, directivesPluginHooks, directivesSystem } from "./plugins/directives/index.js"; | ||
import { ADMONITION_TYPES, AdmonitionDirectiveDescriptor } from "./directive-editors/AdmonitionDirectiveDescriptor.js"; | ||
import { GenericDirectiveEditor } from "./directive-editors/GenericDirectiveEditor.js"; | ||
import { linkDialogPlugin, linkDialogPluginHooks } from "./plugins/link-dialog/index.js"; | ||
import { toolbarPlugin, toolbarPluginHooks, toolbarSystem } from "./plugins/toolbar/index.js"; | ||
import { diffSourcePlugin, diffSourcePluginHooks, diffSourceSystem } from "./plugins/diff-source/index.js"; | ||
import { markdownShortcutPlugin } from "./plugins/markdown-shortcut/index.js"; | ||
import { BlockTypeSelect } from "./plugins/toolbar/components/BlockTypeSelect.js"; | ||
import { BoldItalicUnderlineToggles } from "./plugins/toolbar/components/BoldItalicUnderlineToggles.js"; | ||
import { ChangeAdmonitionType } from "./plugins/toolbar/components/ChangeAdmonitionType.js"; | ||
import { ChangeCodeMirrorLanguage } from "./plugins/toolbar/components/ChangeCodeMirrorLanguage.js"; | ||
import { CodeToggle } from "./plugins/toolbar/components/CodeToggle.js"; | ||
import { CreateLink } from "./plugins/toolbar/components/CreateLink.js"; | ||
import { DiffSourceToggleWrapper } from "./plugins/toolbar/components/DiffSourceToggleWrapper.js"; | ||
import { InsertAdmonition } from "./plugins/toolbar/components/InsertAdmonition.js"; | ||
import { InsertCodeBlock } from "./plugins/toolbar/components/InsertCodeBlock.js"; | ||
import { InsertFrontmatter } from "./plugins/toolbar/components/InsertFrontmatter.js"; | ||
import { InsertImage } from "./plugins/toolbar/components/InsertImage.js"; | ||
import { InsertSandpack } from "./plugins/toolbar/components/InsertSandpack.js"; | ||
import { InsertTable } from "./plugins/toolbar/components/InsertTable.js"; | ||
import { InsertThematicBreak } from "./plugins/toolbar/components/InsertThematicBreak.js"; | ||
import { ListsToggle } from "./plugins/toolbar/components/ListsToggle.js"; | ||
import { ShowSandpackInfo } from "./plugins/toolbar/components/ShowSandpackInfo.js"; | ||
import { UndoRedo } from "./plugins/toolbar/components/UndoRedo.js"; | ||
import { KitchenSinkToolbar } from "./plugins/toolbar/components/KitchenSinkToolbar.js"; | ||
import { Button, ButtonOrDropdownButton, ButtonWithTooltip, ConditionalContents, MultipleChoiceToggleGroup, Root, Separator, SingleChoiceToggleGroup, SingleToggleGroup, ToggleSingleGroupWithItem, ToolbarToggleItem } from "./plugins/toolbar/primitives/toolbar.js"; | ||
import { DialogButton } from "./plugins/toolbar/primitives/DialogButton.js"; | ||
import { TooltipWrap } from "./plugins/toolbar/primitives/TooltipWrap.js"; | ||
import { Select, SelectButtonTrigger, SelectContent, SelectItem, SelectTrigger } from "./plugins/toolbar/primitives/select.js"; | ||
import { useCodeBlockEditorContext } from "./plugins/codeblock/CodeBlockNode.js"; | ||
export { | ||
d as $createAdmonitionNode, | ||
g as $createCodeBlockNode, | ||
j as $createFrontmatterNode, | ||
l as $createImageNode, | ||
m as $createJsxNode, | ||
x as $createLeafDirectiveNode, | ||
p as $createSandpackNode, | ||
w as $createTableNode, | ||
f as $isAdmonitionNode, | ||
h as $isCodeBlockNode, | ||
k as $isFrontmatterNode, | ||
$ as $isImageNode, | ||
n as $isJsxNode, | ||
y as $isLeafDirectiveNode, | ||
q as $isSandpackNode, | ||
v as $isTableNode, | ||
AdmonitionKind, | ||
A as AdmonitionNode, | ||
C as CodeBlockNode, | ||
F as FrontmatterNode, | ||
I as ImageNode, | ||
J as JsxNode, | ||
L as LeafDirectiveNode, | ||
M as MDXEditor, | ||
b as NestedEditor, | ||
o as SandpackNode, | ||
r as TableNode, | ||
T as ToolbarComponents, | ||
z as defaultMdxOptionValues, | ||
c as useMdastNodeUpdater | ||
ADMONITION_TYPES, | ||
AdmonitionDirectiveDescriptor, | ||
BlockTypeSelect, | ||
BoldItalicUnderlineToggles, | ||
Button, | ||
ButtonOrDropdownButton, | ||
ButtonWithTooltip, | ||
ChangeAdmonitionType, | ||
ChangeCodeMirrorLanguage, | ||
CodeToggle, | ||
ConditionalContents, | ||
CreateLink, | ||
DialogButton, | ||
DiffSourceToggleWrapper, | ||
GenericDirectiveEditor, | ||
GenericJsxEditor, | ||
INSERT_IMAGE_COMMAND, | ||
InsertAdmonition, | ||
InsertCodeBlock, | ||
InsertFrontmatter, | ||
InsertImage, | ||
InsertSandpack, | ||
InsertTable, | ||
InsertThematicBreak, | ||
KitchenSinkToolbar, | ||
ListsToggle, | ||
MDXEditor, | ||
MultipleChoiceToggleGroup, | ||
Root, | ||
Select, | ||
SelectButtonTrigger, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
Separator, | ||
ShowSandpackInfo, | ||
SingleChoiceToggleGroup, | ||
SingleToggleGroup, | ||
ToggleSingleGroupWithItem, | ||
ToolbarToggleItem, | ||
TooltipWrap, | ||
UndoRedo, | ||
codeBlockPlugin, | ||
codeBlockPluginHooks, | ||
codeBlockSystem, | ||
codeMirrorHooks, | ||
codeMirrorPlugin, | ||
codeMirrorSystem, | ||
diffSourcePlugin, | ||
diffSourcePluginHooks, | ||
diffSourceSystem, | ||
directivesPlugin, | ||
directivesPluginHooks, | ||
directivesSystem, | ||
frontmatterPlugin, | ||
frontmatterPluginHooks, | ||
frontmatterSystem, | ||
headingsPlugin, | ||
headingsSystem, | ||
imagePlugin, | ||
imagePluginHooks, | ||
imageSystem, | ||
jsxPlugin, | ||
jsxPluginHooks, | ||
jsxSystem, | ||
linkDialogPlugin, | ||
linkDialogPluginHooks, | ||
linkPlugin, | ||
linkSystem, | ||
listsPlugin, | ||
listsPluginHooks, | ||
listsSystem, | ||
markdownShortcutPlugin, | ||
quotePlugin, | ||
quotePluginHooks, | ||
sandpackPlugin, | ||
sandpackPluginHooks, | ||
sandpackSystem, | ||
tablePlugin, | ||
tablePluginHooks, | ||
tableSystem, | ||
thematicBreakPlugin, | ||
thematicBreakPluginHooks, | ||
thematicBreakSystem, | ||
toolbarPlugin, | ||
toolbarPluginHooks, | ||
toolbarSystem, | ||
useCodeBlockEditorContext | ||
}; |
198
package.json
@@ -12,15 +12,3 @@ { | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"./package.json": "./package.json", | ||
"./style.css": "./dist/style.css" | ||
}, | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"version": "0.9.0", | ||
"version": "0.10.0-alpha.1", | ||
"description": "React component for rich text markdown editing", | ||
@@ -30,2 +18,3 @@ "scripts": { | ||
"build:docs:api": "./scripts/build_docs_api.sh", | ||
"build:update-exports": "node ./scripts/generate-exports.js", | ||
"start": "LADLE=true ladle dev", | ||
@@ -137,2 +126,3 @@ "dev": "LADLE=true ladle dev", | ||
"jsdom": "^22.1.0", | ||
"micromark-util-types": "^1.1.0", | ||
"multer": "1.4.5-lts.1", | ||
@@ -165,3 +155,3 @@ "postcss": "^8.4.24", | ||
}, | ||
"packageManager": "pnpm@8.3.0", | ||
"packageManager": "npm@9.5.1", | ||
"repository": { | ||
@@ -186,3 +176,183 @@ "type": "git", | ||
] | ||
}, | ||
"exports": { | ||
"./package.json": "./package.json", | ||
"./style.css": "./dist/style.css", | ||
"./MDXEditor": { | ||
"import": "./dist/MDXEditor.js", | ||
"types": "./dist/MDXEditor.d.ts" | ||
}, | ||
"./directive-editors/AdmonitionDirectiveDescriptor": { | ||
"import": "./dist/directive-editors/AdmonitionDirectiveDescriptor.js", | ||
"types": "./dist/directive-editors/AdmonitionDirectiveDescriptor.d.ts" | ||
}, | ||
"./directive-editors/GenericDirectiveEditor": { | ||
"import": "./dist/directive-editors/GenericDirectiveEditor.js", | ||
"types": "./dist/directive-editors/GenericDirectiveEditor.d.ts" | ||
}, | ||
"./jsx-editors/GenericJsxEditor": { | ||
"import": "./dist/jsx-editors/GenericJsxEditor.js", | ||
"types": "./dist/jsx-editors/GenericJsxEditor.d.ts" | ||
}, | ||
"./plugins/codeblock": { | ||
"types": "./dist/plugins/codeblock/index.d.ts", | ||
"import": "./dist/plugins/codeblock/index.js" | ||
}, | ||
"./plugins/codemirror": { | ||
"types": "./dist/plugins/codemirror/index.d.ts", | ||
"import": "./dist/plugins/codemirror/index.js" | ||
}, | ||
"./plugins/core": { | ||
"types": "./dist/plugins/core/index.d.ts", | ||
"import": "./dist/plugins/core/index.js" | ||
}, | ||
"./plugins/diff-source": { | ||
"types": "./dist/plugins/diff-source/index.d.ts", | ||
"import": "./dist/plugins/diff-source/index.js" | ||
}, | ||
"./plugins/directives": { | ||
"types": "./dist/plugins/directives/index.d.ts", | ||
"import": "./dist/plugins/directives/index.js" | ||
}, | ||
"./plugins/frontmatter": { | ||
"types": "./dist/plugins/frontmatter/index.d.ts", | ||
"import": "./dist/plugins/frontmatter/index.js" | ||
}, | ||
"./plugins/headings": { | ||
"types": "./dist/plugins/headings/index.d.ts", | ||
"import": "./dist/plugins/headings/index.js" | ||
}, | ||
"./plugins/image": { | ||
"types": "./dist/plugins/image/index.d.ts", | ||
"import": "./dist/plugins/image/index.js" | ||
}, | ||
"./plugins/jsx": { | ||
"types": "./dist/plugins/jsx/index.d.ts", | ||
"import": "./dist/plugins/jsx/index.js" | ||
}, | ||
"./plugins/link": { | ||
"types": "./dist/plugins/link/index.d.ts", | ||
"import": "./dist/plugins/link/index.js" | ||
}, | ||
"./plugins/link-dialog": { | ||
"types": "./dist/plugins/link-dialog/index.d.ts", | ||
"import": "./dist/plugins/link-dialog/index.js" | ||
}, | ||
"./plugins/lists": { | ||
"types": "./dist/plugins/lists/index.d.ts", | ||
"import": "./dist/plugins/lists/index.js" | ||
}, | ||
"./plugins/markdown-shortcut": { | ||
"types": "./dist/plugins/markdown-shortcut/index.d.ts", | ||
"import": "./dist/plugins/markdown-shortcut/index.js" | ||
}, | ||
"./plugins/quote": { | ||
"types": "./dist/plugins/quote/index.d.ts", | ||
"import": "./dist/plugins/quote/index.js" | ||
}, | ||
"./plugins/sandpack": { | ||
"types": "./dist/plugins/sandpack/index.d.ts", | ||
"import": "./dist/plugins/sandpack/index.js" | ||
}, | ||
"./plugins/table": { | ||
"types": "./dist/plugins/table/index.d.ts", | ||
"import": "./dist/plugins/table/index.js" | ||
}, | ||
"./plugins/thematic-break": { | ||
"types": "./dist/plugins/thematic-break/index.d.ts", | ||
"import": "./dist/plugins/thematic-break/index.js" | ||
}, | ||
"./plugins/toolbar": { | ||
"types": "./dist/plugins/toolbar/index.d.ts", | ||
"import": "./dist/plugins/toolbar/index.js" | ||
}, | ||
"./plugins/toolbar/components/BlockTypeSelect": { | ||
"types": "./dist/plugins/toolbar/components/BlockTypeSelect.d.ts", | ||
"import": "./dist/plugins/toolbar/components/BlockTypeSelect.js" | ||
}, | ||
"./plugins/toolbar/components/BoldItalicUnderlineToggles": { | ||
"types": "./dist/plugins/toolbar/components/BoldItalicUnderlineToggles.d.ts", | ||
"import": "./dist/plugins/toolbar/components/BoldItalicUnderlineToggles.js" | ||
}, | ||
"./plugins/toolbar/components/ChangeAdmonitionType": { | ||
"types": "./dist/plugins/toolbar/components/ChangeAdmonitionType.d.ts", | ||
"import": "./dist/plugins/toolbar/components/ChangeAdmonitionType.js" | ||
}, | ||
"./plugins/toolbar/components/ChangeCodeMirrorLanguage": { | ||
"types": "./dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.d.ts", | ||
"import": "./dist/plugins/toolbar/components/ChangeCodeMirrorLanguage.js" | ||
}, | ||
"./plugins/toolbar/components/CodeToggle": { | ||
"types": "./dist/plugins/toolbar/components/CodeToggle.d.ts", | ||
"import": "./dist/plugins/toolbar/components/CodeToggle.js" | ||
}, | ||
"./plugins/toolbar/components/CreateLink": { | ||
"types": "./dist/plugins/toolbar/components/CreateLink.d.ts", | ||
"import": "./dist/plugins/toolbar/components/CreateLink.js" | ||
}, | ||
"./plugins/toolbar/components/DiffSourceToggleWrapper": { | ||
"types": "./dist/plugins/toolbar/components/DiffSourceToggleWrapper.d.ts", | ||
"import": "./dist/plugins/toolbar/components/DiffSourceToggleWrapper.js" | ||
}, | ||
"./plugins/toolbar/components/InsertAdmonition": { | ||
"types": "./dist/plugins/toolbar/components/InsertAdmonition.d.ts", | ||
"import": "./dist/plugins/toolbar/components/InsertAdmonition.js" | ||
}, | ||
"./plugins/toolbar/components/InsertCodeBlock": { | ||
"types": "./dist/plugins/toolbar/components/InsertCodeBlock.d.ts", | ||
"import": "./dist/plugins/toolbar/components/InsertCodeBlock.js" | ||
}, | ||
"./plugins/toolbar/components/InsertFrontmatter": { | ||
"types": "./dist/plugins/toolbar/components/InsertFrontmatter.d.ts", | ||
"import": "./dist/plugins/toolbar/components/InsertFrontmatter.js" | ||
}, | ||
"./plugins/toolbar/components/InsertImage": { | ||
"types": "./dist/plugins/toolbar/components/InsertImage.d.ts", | ||
"import": "./dist/plugins/toolbar/components/InsertImage.js" | ||
}, | ||
"./plugins/toolbar/components/InsertSandpack": { | ||
"types": "./dist/plugins/toolbar/components/InsertSandpack.d.ts", | ||
"import": "./dist/plugins/toolbar/components/InsertSandpack.js" | ||
}, | ||
"./plugins/toolbar/components/InsertTable": { | ||
"types": "./dist/plugins/toolbar/components/InsertTable.d.ts", | ||
"import": "./dist/plugins/toolbar/components/InsertTable.js" | ||
}, | ||
"./plugins/toolbar/components/InsertThematicBreak": { | ||
"types": "./dist/plugins/toolbar/components/InsertThematicBreak.d.ts", | ||
"import": "./dist/plugins/toolbar/components/InsertThematicBreak.js" | ||
}, | ||
"./plugins/toolbar/components/KitchenSinkToolbar": { | ||
"types": "./dist/plugins/toolbar/components/KitchenSinkToolbar.d.ts", | ||
"import": "./dist/plugins/toolbar/components/KitchenSinkToolbar.js" | ||
}, | ||
"./plugins/toolbar/components/ListsToggle": { | ||
"types": "./dist/plugins/toolbar/components/ListsToggle.d.ts", | ||
"import": "./dist/plugins/toolbar/components/ListsToggle.js" | ||
}, | ||
"./plugins/toolbar/components/ShowSandpackInfo": { | ||
"types": "./dist/plugins/toolbar/components/ShowSandpackInfo.d.ts", | ||
"import": "./dist/plugins/toolbar/components/ShowSandpackInfo.js" | ||
}, | ||
"./plugins/toolbar/components/UndoRedo": { | ||
"types": "./dist/plugins/toolbar/components/UndoRedo.d.ts", | ||
"import": "./dist/plugins/toolbar/components/UndoRedo.js" | ||
}, | ||
"./plugins/toolbar/primitives/DialogButton": { | ||
"types": "./dist/plugins/toolbar/primitives/DialogButton.d.ts", | ||
"import": "./dist/plugins/toolbar/primitives/DialogButton.js" | ||
}, | ||
"./plugins/toolbar/primitives/TooltipWrap": { | ||
"types": "./dist/plugins/toolbar/primitives/TooltipWrap.d.ts", | ||
"import": "./dist/plugins/toolbar/primitives/TooltipWrap.js" | ||
}, | ||
"./plugins/toolbar/primitives/select": { | ||
"types": "./dist/plugins/toolbar/primitives/select.d.ts", | ||
"import": "./dist/plugins/toolbar/primitives/select.js" | ||
}, | ||
"./plugins/toolbar/primitives/toolbar": { | ||
"types": "./dist/plugins/toolbar/primitives/toolbar.d.ts", | ||
"import": "./dist/plugins/toolbar/primitives/toolbar.js" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
1142606
273
18049
1
1
58