import { Accessor, Component, JSX, JSXElement, ParentProps } from "solid-js"; import { Editor, Extension, Keymap, Priority } from "@prosekit/core"; import { MarkViewContextProps, NodeViewContextProps } from "@prosemirror-adapter/solid"; import { CoreMarkViewUserOptions, CoreNodeViewUserOptions } from "@prosemirror-adapter/core"; import { ProseMirrorNode } from "@prosekit/pm/model"; import { EditorState } from "@prosekit/pm/state"; type ProseKitProps = ParentProps<{ editor: Editor; }>; /** * The root component for a ProseKit editor. */ export declare const ProseKit: Component; interface SolidMarkViewProps extends MarkViewContextProps {} type SolidMarkViewComponent = Component; /** * Options for {@link defineSolidMarkView}. */ interface SolidMarkViewOptions extends CoreMarkViewUserOptions { /** * The name of the mark type. */ name: string; } /** * Defines a mark view using a Solid component. */ export declare function defineSolidMarkView(options: SolidMarkViewOptions): Extension; interface SolidNodeViewProps extends NodeViewContextProps {} type SolidNodeViewComponent = Component; /** * Options for {@link defineSolidNodeView}. */ interface SolidNodeViewOptions extends CoreNodeViewUserOptions { /** * The name of the node type. */ name: string; } /** * Defines a node view using a Solid component. */ export declare function defineSolidNodeView(options: SolidNodeViewOptions): Extension; /** * @internal */ type PropsWithClass

= P & { class?: string | undefined; }; /** * @internal */ type PropsWithChildren

= P & { children?: JSXElement | undefined; }; /** * @internal */ type PropsWithElement = Props & JSX.HTMLAttributes; /** * T or a reactive/non-reactive function returning T */ type MaybeAccessor = T | Accessor; interface UseExtensionOptions { /** * The editor to add the extension to. If not provided, it will use the * editor from the nearest `` component. */ editor?: MaybeAccessor; /** * Optional priority to add the extension with. */ priority?: Priority; } /** * Add an extension to the editor. */ export declare function useExtension( /** * The accessor to an extension to add to the editor. If it changes, the previous * extension will be removed and the new one (if not null) will be added. */ extension: Accessor, options?: UseExtensionOptions): void; /** * Calls the given handler whenever the editor document changes. */ export declare function useDocChange(handler: (doc: ProseMirrorNode) => void, options?: UseExtensionOptions): void; interface UseEditorDerivedOptions { /** * The editor to add the extension to. If not provided, it will use the * editor from the nearest `` component. */ editor?: MaybeAccessor>; } /** * Runs a function to derive a value from the editor instance after editor state * changes. * * This is useful when you need to render something based on the editor state, * for example, whether the selected text is wrapped in an italic mark. * * It returns an accessor of the derived value that updates whenever the editor * state changes. */ export declare function useEditorDerivedValue( /** * A function that receives the editor instance and returns a derived value. * * It will be called whenever the editor's document state changes, or when it * mounts. */ derive: (editor: Editor) => Derived, options?: UseEditorDerivedOptions): Accessor; /** * Retrieves the editor instance from the nearest ProseKit component. */ export declare function useEditor(options?: { /** * Whether to update the component when the editor is mounted or editor state * is updated. * * @default false */ update?: boolean; }): () => Editor; export declare function useKeymap(keymap: () => Keymap, options?: UseExtensionOptions): void; /** * Calls the given handler whenever the editor state changes. */ export declare function useStateUpdate(handler: (state: EditorState) => void, options?: UseExtensionOptions): void; export type { MaybeAccessor, PropsWithChildren, PropsWithClass, PropsWithElement, ProseKitProps, SolidMarkViewComponent, SolidMarkViewOptions, SolidMarkViewProps, SolidNodeViewComponent, SolidNodeViewOptions, SolidNodeViewProps, UseEditorDerivedOptions, UseExtensionOptions }; //# sourceMappingURL=index.d.ts.map