import { O as ComarkKitOptions, v as PageParser } from "./editor-ChwphWPN.mjs"; import { ComarkPlugin } from "comark"; import { AnyExtension, NodeViewRenderer } from "@tiptap/core"; import { Editor } from "@tiptap/vue-3"; import { PropertiesOptions } from "comark-properties"; import { Component, PropType, Ref, SlotsType, VNode, VNodeChild } from "vue"; //#region src/editor/component-view.d.ts /** One prop a component takes, as the props panel edits it. */ interface ComponentProp { /** * `string` (the default), `number`, `boolean`, or `json`, each with its own field. Any other name, such as `image`, * reads and writes a string and is the `field` hook's to draw. */ type?: "string" | "number" | "boolean" | "json" | (string & {}); label?: string; description?: string; /** What the component uses when the prop is left out. The field shows it and doesn't write it. */ default?: unknown; /** The values a string takes, drawn as a select. */ options?: readonly string[]; } /** What the editor shows for one component name. */ interface ComponentInfo { /** Shown instead of the name. The name stays beside it. */ label?: string; /** A class for an icon element, such as UnoCSS's `i-lucide-chart-bar`, or a Vue component. */ icon?: string | Component; /** The props the panel edits with typed fields. Props a document has beyond these show as names and values. */ props?: Record; } /** A field of the props panel, given to `field` so a host can draw its own control, such as a media picker. */ interface ComponentField { /** The component's name, such as `card`. */ component: string; /** The prop's name, such as `icon`. */ name: string; prop: ComponentProp; /** The prop's value read as its type, or `undefined` when the document leaves it out. */ value: unknown; /** Sets the prop through a transaction. `undefined` removes it. */ update(value: unknown): void; editable: boolean; /** The id the field's label points at. */ id: string; } interface ComponentViewOptions { /** What to show for each component name. A component that isn't listed shows its name and edits props as text. */ components?: Record; /** Draws a typed field. Return `undefined` for the panel's own field. */ field?: (field: ComponentField) => VNodeChild | undefined; } /** * The node view `ComarkKit`'s `componentView` option takes: a block component shows its name and props above its * editable content and slots, and an inline one a tag after its text. Each opens a panel that edits the props through * a transaction on the node's `props` attribute, so the schema and the Markdown the codec writes stay as they are. */ export declare function componentView(options?: ComponentViewOptions): NodeViewRenderer; /** The view's styles, which it adds to the page with the first component. */ export declare const componentViewCss: string; //#endregion //#region src/editor/code-languages.d.ts /** What the `#select` slot gets for each code block. */ interface CodeLanguageSlot { /** The name in `languages` the block's language stands for. */ language: string | undefined; /** The block's language as written, which shows when it isn't in `languages`. */ written: string | undefined; /** Whether the editor takes edits. */ editable: boolean; /** Sets the block's language. `null` makes it plain text. */ choose: (language: string | null) => void; } export declare const codeLanguagesCss: string; /** * A language select in the top right corner of each code block. It sits over the editor rather than inside it, so * ProseMirror's DOM stays as the schema draws it, and a choice is an edit to the block's `language` attribute, which a * collaborative room syncs like any other. Place it beside `EditorContent` in a positioned element. */ export declare const CodeLanguageSelect: import("vue").DefineComponent; required: true; }; /** The languages it offers, by name, with the label each shows. */ languages: { type: PropType>; required: true; }; /** The name in `languages` a block's language stands for, such as an alias's. Its first word by default. */ language: { type: PropType<(info: string) => string | undefined>; default: undefined; }; }>, () => import("vue").VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly; required: true; }; /** The languages it offers, by name, with the label each shows. */ languages: { type: PropType>; required: true; }; /** The name in `languages` a block's language stands for, such as an alias's. Its first word by default. */ language: { type: PropType<(info: string) => string | undefined>; default: undefined; }; }>> & Readonly<{}>, { language: (info: string) => string | undefined; }, SlotsType<{ select: CodeLanguageSlot; }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>; //#endregion //#region src/editor-vue.d.ts /** * Pass how the page parses Markdown, `plugins` and `registerDefaultPlugins` as given to Comark's parser, so the editor * reads a document as readers see it, and opens read-only one a save would change for them. */ export interface UseComarkEditorOptions extends PageParser { /** Added after ComarkKit, such as a placeholder. */ extensions?: AnyExtension[]; kit?: ComarkKitOptions; /** * What the component view shows for each component name, with the props it edits as typed fields, or `false` to * draw components as bare elements. A `componentView` in `kit` replaces the view. */ components?: Record | false; /** Draws a typed prop's field, such as a media picker. Return `undefined` for the view's own field. */ field?: (field: ComponentField) => VNodeChild | undefined; } /** * A Tiptap editor bound to a Markdown string: an edit writes the Markdown back, and a change from outside reloads the * editor. A document the editor can't save unchanged (see `checkMarkdown`) opens read-only, with `editable` false. */ export declare function useComarkEditor(markdown: Ref, options?: UseComarkEditorOptions): { editor: import("vue").ShallowRef; editable: Ref; frontmatter: import("vue").ShallowRef, Record>; }; /** * `useComarkEditor` as a component: ``. The frontmatter keys that comark-properties * shows on the page show above the text the same way, read-only. Pass its options in `properties`, or `false` to hide them. * `components` and the `#field` slot set up the component view, as the composable's `components` and `field` do. */ export declare const ComarkEditor: import("vue").DefineComponent; default: boolean; }; modelValue: { type: StringConstructor; required: true; }; extensions: { type: PropType; default: undefined; }; plugins: { type: PropType[]>; default: undefined; }; components: { type: PropType | false>; default: undefined; }; registerDefaultPlugins: { type: BooleanConstructor; default: undefined; }; }>, () => VNode | VNode[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly; default: boolean; }; modelValue: { type: StringConstructor; required: true; }; extensions: { type: PropType; default: undefined; }; plugins: { type: PropType[]>; default: undefined; }; components: { type: PropType | false>; default: undefined; }; registerDefaultPlugins: { type: BooleanConstructor; default: undefined; }; }>> & Readonly<{ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined; }>, { properties: boolean | PropertiesOptions; extensions: AnyExtension[]; plugins: ComarkPlugin[]; components: false | Record; registerDefaultPlugins: boolean; }, SlotsType<{ field: ComponentField; }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>; //#endregion export type { CodeLanguageSlot, ComponentField, ComponentInfo, ComponentProp, ComponentViewOptions };