@humanonlyweb/writer 0.0.0-stage → 0.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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -2
  3. package/dist/components/WriterContent.d.ts +57 -0
  4. package/dist/components/WriterContent.js +114 -0
  5. package/dist/components/WriterEditor.js +232 -0
  6. package/dist/components/WriterEditor.vue.d.ts +70 -0
  7. package/dist/components/WriterToolbar.js +135 -0
  8. package/dist/components/WriterToolbar.vue.d.ts +27 -0
  9. package/dist/config.d.ts +39 -0
  10. package/dist/config.js +41 -0
  11. package/dist/docs/README.md +24 -0
  12. package/dist/docs/blocks.md +64 -0
  13. package/dist/docs/changelog.md +17 -0
  14. package/dist/docs/components/content.md +51 -0
  15. package/dist/docs/components/editor.md +236 -0
  16. package/dist/docs/components/toolbar.md +146 -0
  17. package/dist/docs/images.md +80 -0
  18. package/dist/docs/index.md +86 -0
  19. package/dist/docs/installation.md +74 -0
  20. package/dist/docs/limitations.md +11 -0
  21. package/dist/docs/localisation.md +35 -0
  22. package/dist/docs/parsing.md +47 -0
  23. package/dist/docs/security.md +16 -0
  24. package/dist/docs/storing.md +105 -0
  25. package/dist/docs/styling.md +47 -0
  26. package/dist/docs/word-count.md +16 -0
  27. package/dist/editor/commands.d.ts +1 -0
  28. package/dist/editor/commands.js +359 -0
  29. package/dist/editor/images.d.ts +1 -0
  30. package/dist/editor/images.js +400 -0
  31. package/dist/editor/live.d.ts +2 -0
  32. package/dist/editor/live.js +411 -0
  33. package/dist/editor/setup.d.ts +9 -0
  34. package/dist/editor/setup.js +485 -0
  35. package/dist/index.d.ts +11 -0
  36. package/dist/index.js +8 -0
  37. package/dist/load-parser.js +12 -0
  38. package/dist/nuxt/module.d.ts +35 -0
  39. package/dist/nuxt/module.js +114 -0
  40. package/dist/nuxt/runtime/plugin.d.ts +2 -0
  41. package/dist/nuxt/runtime/plugin.js +25 -0
  42. package/dist/nuxt/runtime/server/parse.d.ts +12 -0
  43. package/dist/nuxt/runtime/server/parse.js +15 -0
  44. package/dist/package.js +3 -0
  45. package/dist/parse.d.ts +16 -0
  46. package/dist/parse.js +62 -0
  47. package/dist/parser-options.d.ts +19 -0
  48. package/dist/placeholder.js +5 -0
  49. package/dist/render.d.ts +10 -0
  50. package/dist/render.js +97 -0
  51. package/dist/sanitize.d.ts +11 -0
  52. package/dist/sanitize.js +139 -0
  53. package/dist/stats.d.ts +8 -0
  54. package/dist/stats.js +17 -0
  55. package/dist/styles/core.css +275 -0
  56. package/dist/translations.d.ts +26 -0
  57. package/dist/translations.js +47 -0
  58. package/dist/types.d.ts +9 -0
  59. package/package.json +101 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 humanonlyweb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,63 @@
1
- # Temporary Holding Version
1
+ # @humanonlyweb/writer
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A Markdown editor and renderer for Vue 3 and Nuxt. You write Markdown; it reads like the published page. Blocks are your own Vue components. SSR-safe, accessible, unstyled.
4
+
5
+ **Docs:** [writer.humanonlyweb.com](https://writer.humanonlyweb.com) · for AI agents: [llms.txt](https://writer.humanonlyweb.com/llms.txt), or the same docs in the package, at `node_modules/@humanonlyweb/writer/dist/docs`
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ bun add @humanonlyweb/writer
11
+ ```
12
+
13
+ **Nuxt**
14
+
15
+ ```ts
16
+ export default defineNuxtConfig({
17
+ modules: ["@humanonlyweb/writer/nuxt"],
18
+ });
19
+ ```
20
+
21
+ **Vue**
22
+
23
+ ```ts
24
+ import { createWriter } from "@humanonlyweb/writer";
25
+ import "@humanonlyweb/writer/core.css";
26
+
27
+ createApp(App).use(createWriter()).mount("#app");
28
+ ```
29
+
30
+ ## Use
31
+
32
+ ```vue
33
+ <script setup lang="ts">
34
+ const body = ref("");
35
+ const editor = useTemplateRef("editor");
36
+ </script>
37
+
38
+ <template>
39
+ <WriterToolbar :editor="editor" />
40
+ <WriterEditor ref="editor" v-model="body" label="Post body" />
41
+ <WriterContent :value="body" />
42
+ </template>
43
+ ```
44
+
45
+ Store the Markdown, parse it on save, and render the parsed document: see [Storing documents](https://writer.humanonlyweb.com/storing).
46
+
47
+ ## Development
48
+
49
+ ```bash
50
+ bun install
51
+ bunx playwright install chromium firefox webkit # once, for the browser tests
52
+ bun run build # library, then the docs as Markdown → dist/
53
+ bun run test # Node (SSR, parser, commands) + browsers
54
+ bun run check # format, lint, types
55
+ bun run typecheck # vue-tsc
56
+ bun run docs # docs site, from source
57
+ ```
58
+
59
+ Release: bump `version` and push a `v*` tag. CI tests, publishes to npm and creates a GitHub Release.
60
+
61
+ ## License
62
+
63
+ MIT
@@ -0,0 +1,57 @@
1
+ import { Component, PropType } from "vue";
2
+ import { MarkdownDocument } from "comark";
3
+ /**
4
+ * Renders Markdown, or a document parsed ahead of time with `@humanonlyweb/writer/parse`.
5
+ * Only native Markdown elements and registered blocks render.
6
+ */
7
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ /** A Markdown string, or a parsed document (renders without loading the parser). */
9
+ value: {
10
+ type: PropType<string | MarkdownDocument>;
11
+ default: string;
12
+ };
13
+ /** Merged over the app's `components` for this render. */
14
+ components: {
15
+ type: PropType<Record<string, Component>>;
16
+ default: undefined;
17
+ };
18
+ /** Milliseconds to wait after the Markdown changes before parsing again. Use ~100 for live previews of long documents. */
19
+ debounce: {
20
+ type: NumberConstructor;
21
+ default: number;
22
+ };
23
+ /** The wrapping element. */
24
+ tag: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ };
28
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
29
+ [key: string]: any;
30
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
31
+ /** A Markdown string, or a parsed document (renders without loading the parser). */
32
+ value: {
33
+ type: PropType<string | MarkdownDocument>;
34
+ default: string;
35
+ };
36
+ /** Merged over the app's `components` for this render. */
37
+ components: {
38
+ type: PropType<Record<string, Component>>;
39
+ default: undefined;
40
+ };
41
+ /** Milliseconds to wait after the Markdown changes before parsing again. Use ~100 for live previews of long documents. */
42
+ debounce: {
43
+ type: NumberConstructor;
44
+ default: number;
45
+ };
46
+ /** The wrapping element. */
47
+ tag: {
48
+ type: StringConstructor;
49
+ default: string;
50
+ };
51
+ }>> & Readonly<{}>, {
52
+ components: Record<string, Component>;
53
+ value: string | MarkdownDocument<Record<string, any>, Record<string, any>>;
54
+ debounce: number;
55
+ tag: string;
56
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
57
+ export { _default as default };
@@ -0,0 +1,114 @@
1
+ import { useWriterConfig } from "../config.js";
2
+ import { loadParser } from "../load-parser.js";
3
+ import { renderDocument } from "../render.js";
4
+ import { isMarkdownDocument } from "comark/utils";
5
+ import { Suspense, computed, defineComponent, h, onScopeDispose, shallowRef, watch } from "vue";
6
+ // src/components/WriterContent.ts
7
+ const EMPTY = {
8
+ nodes: [],
9
+ frontmatter: {},
10
+ meta: {}
11
+ };
12
+ /**
13
+ * Parses `source`, then again whenever it changes: one parse at a time, always ending on
14
+ * the latest. Its default slot renders the document.
15
+ */
16
+ const ParsedContent = defineComponent({
17
+ name: "WriterParsedContent",
18
+ props: {
19
+ source: {
20
+ type: String,
21
+ required: true
22
+ },
23
+ parser: {
24
+ type: Object,
25
+ required: true
26
+ },
27
+ debounce: {
28
+ type: Number,
29
+ default: 0
30
+ }
31
+ },
32
+ async setup(props, { slots }) {
33
+ const document = shallowRef(EMPTY);
34
+ let running;
35
+ let queued = false;
36
+ async function parseLatest() {
37
+ queued = false;
38
+ try {
39
+ const parse = await loadParser(props.parser);
40
+ document.value = await parse(props.source);
41
+ } catch (error) {
42
+ console.error("[writer] couldn't parse Markdown:", error);
43
+ }
44
+ if (queued) return parseLatest();
45
+ }
46
+ function update() {
47
+ if (running) {
48
+ queued = true;
49
+ return running;
50
+ }
51
+ running = parseLatest().finally(() => running = void 0);
52
+ return running;
53
+ }
54
+ let timer;
55
+ watch(() => props.source, () => {
56
+ clearTimeout(timer);
57
+ if (props.debounce > 0) timer = setTimeout(update, props.debounce);
58
+ else update();
59
+ });
60
+ onScopeDispose(() => clearTimeout(timer));
61
+ await update();
62
+ return () => slots.default?.(document.value);
63
+ }
64
+ });
65
+ /**
66
+ * Renders Markdown, or a document parsed ahead of time with `@humanonlyweb/writer/parse`.
67
+ * Only native Markdown elements and registered blocks render.
68
+ */
69
+ var WriterContent_default = defineComponent({
70
+ name: "WriterContent",
71
+ props: {
72
+ /** A Markdown string, or a parsed document (renders without loading the parser). */
73
+ value: {
74
+ type: [String, Object],
75
+ default: ""
76
+ },
77
+ /** Merged over the app's `components` for this render. */
78
+ components: {
79
+ type: Object,
80
+ default: void 0
81
+ },
82
+ /** Milliseconds to wait after the Markdown changes before parsing again. Use ~100 for live previews of long documents. */
83
+ debounce: {
84
+ type: Number,
85
+ default: 0
86
+ },
87
+ /** The wrapping element. */
88
+ tag: {
89
+ type: String,
90
+ default: "div"
91
+ }
92
+ },
93
+ setup(props) {
94
+ const config = useWriterConfig();
95
+ const options = computed(() => ({
96
+ blocks: Object.fromEntries(Object.entries(config.blocks).map(([name, block]) => [name, block.component])),
97
+ components: {
98
+ ...config.components,
99
+ ...props.components
100
+ }
101
+ }));
102
+ const render = (document) => h(props.tag, { "data-part": "writer-content" }, renderDocument(document, options.value));
103
+ return () => {
104
+ const { value } = props;
105
+ if (isMarkdownDocument(value)) return render(value);
106
+ return h(Suspense, null, { default: () => h(ParsedContent, {
107
+ source: value,
108
+ parser: config.parser,
109
+ debounce: props.debounce
110
+ }, { default: render }) });
111
+ };
112
+ }
113
+ });
114
+ export { WriterContent_default as default };
@@ -0,0 +1,232 @@
1
+ import { useTranslations, useWriterConfig } from "../config.js";
2
+ import { loadParser } from "../load-parser.js";
3
+ import WriterContent_default from "./WriterContent.js";
4
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, h, mergeModels, nextTick, onBeforeUnmount, onMounted, openBlock, render, shallowRef, unref, useModel, useTemplateRef, watch } from "vue";
5
+ // src/components/WriterEditor.vue
6
+ const _hoisted_1 = [
7
+ "data-mode",
8
+ "data-ready",
9
+ "data-readonly"
10
+ ];
11
+ const _hoisted_2 = {
12
+ key: 0,
13
+ "data-part": "writer-fallback",
14
+ "aria-busy": "true"
15
+ };
16
+ const _hoisted_3 = [
17
+ "name",
18
+ "value",
19
+ "aria-label",
20
+ "aria-labelledby",
21
+ "aria-describedby",
22
+ "placeholder",
23
+ "readonly"
24
+ ];
25
+ const _hoisted_4 = ["hidden"];
26
+ const _hoisted_5 = ["name", "value"];
27
+ const _sfc_main = /*@__PURE__*/ defineComponent({
28
+ __name: "WriterEditor",
29
+ props: /*@__PURE__*/ mergeModels({
30
+ label: {},
31
+ labelledby: {},
32
+ describedby: {},
33
+ name: {},
34
+ placeholder: {},
35
+ readonly: { type: Boolean },
36
+ mode: {},
37
+ upload: { type: Function },
38
+ links: { type: Function },
39
+ codeLanguages: {},
40
+ extensions: {}
41
+ }, {
42
+ "modelValue": { default: "" },
43
+ "modelModifiers": {}
44
+ }),
45
+ emits: /*@__PURE__*/ mergeModels([
46
+ "focus",
47
+ "blur",
48
+ "uploadError"
49
+ ], ["update:modelValue"]),
50
+ setup(__props, { expose: __expose, emit: __emit }) {
51
+ const model = useModel(__props, "modelValue");
52
+ const props = __props;
53
+ const emit = __emit;
54
+ const t = useTranslations();
55
+ const config = useWriterConfig();
56
+ const appContext = getCurrentInstance()?.appContext ?? null;
57
+ const previews = /* @__PURE__ */ new Map();
58
+ const renderPreview = async (source, host) => {
59
+ let document = previews.get(source);
60
+ if (!document) {
61
+ document = await (await loadParser(config.parser))(source);
62
+ previews.set(source, document);
63
+ if (previews.size > 200) previews.delete(previews.keys().next().value);
64
+ }
65
+ const vnode = h(WriterContent_default, { value: document });
66
+ vnode.appContext = appContext;
67
+ render(vnode, host);
68
+ return () => render(null, host);
69
+ };
70
+ const preview = () => props.mode === "source" ? void 0 : renderPreview;
71
+ const fallback = useTemplateRef("fallback");
72
+ const host = useTemplateRef("host");
73
+ const picker = useTemplateRef("picker");
74
+ const editorCode = typeof window === "undefined" ? void 0 : import("../editor/setup.js");
75
+ const ready = shallowRef(false);
76
+ const active = shallowRef(/* @__PURE__ */ new Set());
77
+ const canUndo = shallowRef(false);
78
+ const uploading = shallowRef(0);
79
+ const canRedo = shallowRef(false);
80
+ let editor;
81
+ let unmounted = false;
82
+ const attributes = computed(() => {
83
+ const result = {
84
+ spellcheck: "true",
85
+ autocapitalize: "sentences"
86
+ };
87
+ if (props.labelledby) result["aria-labelledby"] = props.labelledby;
88
+ else result["aria-label"] = props.label ?? t.value.editor;
89
+ if (props.describedby) result["aria-describedby"] = props.describedby;
90
+ if (props.placeholder) result["aria-placeholder"] = props.placeholder;
91
+ if (props.readonly) result["aria-readonly"] = "true";
92
+ return result;
93
+ });
94
+ onMounted(async () => {
95
+ const { createEditor } = await (editorCode ?? import("../editor/setup.js"));
96
+ if (unmounted || !host.value) return;
97
+ const textarea = fallback.value;
98
+ const focused = !!textarea && document.activeElement === textarea;
99
+ editor = createEditor({
100
+ parent: host.value,
101
+ doc: textarea?.value ?? model.value,
102
+ selection: textarea && focused ? {
103
+ anchor: textarea.selectionStart,
104
+ head: textarea.selectionEnd
105
+ } : void 0,
106
+ attributes: attributes.value,
107
+ placeholder: props.placeholder,
108
+ readonly: props.readonly,
109
+ preview: preview(),
110
+ blocks: Object.entries(config.blocks).map(([name, block]) => ({
111
+ name,
112
+ label: block.label,
113
+ snippet: block.snippet
114
+ })),
115
+ translations: t.value,
116
+ codeLanguages: props.codeLanguages,
117
+ extensions: props.extensions,
118
+ upload: props.upload,
119
+ links: props.links,
120
+ onChange: (doc) => model.value = doc,
121
+ onState: (state) => {
122
+ active.value = state.active;
123
+ canUndo.value = state.undo;
124
+ canRedo.value = state.redo;
125
+ },
126
+ onFocus: (value) => value ? emit("focus") : emit("blur"),
127
+ onUploadError: (error, file) => emit("uploadError", error, file),
128
+ onUploading: (count) => uploading.value = count
129
+ });
130
+ if (editor.getDoc() !== model.value) model.value = editor.getDoc();
131
+ ready.value = true;
132
+ await nextTick();
133
+ editor.view.requestMeasure();
134
+ if (focused) editor.view.focus();
135
+ });
136
+ onBeforeUnmount(() => {
137
+ unmounted = true;
138
+ editor?.destroy();
139
+ });
140
+ watch(model, (value) => editor?.setDoc(value ?? ""));
141
+ watch(() => props.readonly, (value) => editor?.setReadonly(value));
142
+ watch(attributes, (value) => editor?.setAttributes(value));
143
+ watch(() => props.mode, () => editor?.setPreview(preview()));
144
+ function onFallbackInput(event) {
145
+ model.value = event.target.value;
146
+ }
147
+ function onPick(event) {
148
+ const input = event.target;
149
+ if (input.files?.length) editor?.insertFiles([...input.files]);
150
+ input.value = "";
151
+ editor?.view.focus();
152
+ }
153
+ __expose({
154
+ /** True once CodeMirror has replaced the server-rendered fallback. */
155
+ ready,
156
+ /** Formatting at the cursor. */
157
+ active,
158
+ /** Whether files can be inserted (an `upload` is set). */
159
+ canUpload: computed(() => !!props.upload),
160
+ canUndo,
161
+ canRedo,
162
+ /**
163
+ * Uploads in progress. Until they finish, their files are placeholders in the
164
+ * Markdown: wait for 0 before saving.
165
+ */
166
+ uploading,
167
+ /** Applies a command. `image` opens the file picker with uploads, else inserts an empty image. */
168
+ run(command) {
169
+ if (!editor || props.readonly) return false;
170
+ if (command !== "image") return editor.run(command);
171
+ if (props.upload) picker.value?.click();
172
+ else editor.insertImage();
173
+ return true;
174
+ },
175
+ /** Replaces the selection with `text`. */
176
+ insert: (text) => editor?.insert(text),
177
+ /** Uploads and inserts files at the cursor. */
178
+ insertFiles: (files) => editor?.insertFiles(files) ?? false,
179
+ focus: () => editor ? editor.view.focus() : fallback.value?.focus(),
180
+ /** The CodeMirror view, for anything else. */
181
+ view: () => editor?.view
182
+ });
183
+ return (_ctx, _cache) => {
184
+ return openBlock(), createElementBlock("div", {
185
+ "data-part": "writer-editor",
186
+ "data-mode": __props.mode ?? "live",
187
+ "data-ready": ready.value || void 0,
188
+ "data-readonly": __props.readonly || void 0
189
+ }, [
190
+ !ready.value && __props.mode !== "source" ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(WriterContent_default), { value: model.value }, null, 8, ["value"])])) : !ready.value ? (openBlock(), createElementBlock("textarea", {
191
+ key: 1,
192
+ ref_key: "fallback",
193
+ ref: fallback,
194
+ "data-part": "writer-fallback",
195
+ name: __props.name,
196
+ value: model.value,
197
+ "aria-label": __props.labelledby ? void 0 : __props.label ?? unref(t).editor,
198
+ "aria-labelledby": __props.labelledby,
199
+ "aria-describedby": __props.describedby,
200
+ placeholder: __props.placeholder,
201
+ readonly: __props.readonly,
202
+ spellcheck: "true",
203
+ onInput: onFallbackInput
204
+ }, null, 40, _hoisted_3)) : createCommentVNode("v-if", true),
205
+ createElementVNode("div", {
206
+ ref_key: "host",
207
+ ref: host,
208
+ "data-part": "writer-host",
209
+ hidden: !ready.value
210
+ }, null, 8, _hoisted_4),
211
+ __props.name && (ready.value || __props.mode !== "source") ? (openBlock(), createElementBlock("input", {
212
+ key: 2,
213
+ type: "hidden",
214
+ name: __props.name,
215
+ value: model.value
216
+ }, null, 8, _hoisted_5)) : createCommentVNode("v-if", true),
217
+ __props.upload ? (openBlock(), createElementBlock("input", {
218
+ key: 3,
219
+ ref_key: "picker",
220
+ ref: picker,
221
+ type: "file",
222
+ accept: "image/*",
223
+ multiple: "",
224
+ hidden: "",
225
+ tabindex: "-1",
226
+ onChange: onPick
227
+ }, null, 544)) : createCommentVNode("v-if", true)
228
+ ], 8, _hoisted_1);
229
+ };
230
+ }
231
+ });
232
+ export { _sfc_main as default };
@@ -0,0 +1,70 @@
1
+ import { CommandName } from "../translations.js";
2
+ import { LinkSuggestion } from "../editor/setup.js";
3
+ import { LanguageDescription } from "@codemirror/language";
4
+ import { Extension } from "@codemirror/state";
5
+ import { EditorView } from "@codemirror/view";
6
+ type __VLS_Props = {
7
+ /** Accessible name. Defaults to the "editor" translation. */
8
+ label?: string;
9
+ /** Id of an element naming the editor, instead of `label`. */
10
+ labelledby?: string;
11
+ /** Id of an element describing the editor, e.g. a hint or an error. */
12
+ describedby?: string;
13
+ /** Form field name: the Markdown is submitted with its form. */
14
+ name?: string;
15
+ placeholder?: string;
16
+ readonly?: boolean;
17
+ /**
18
+ * `live` (default): blocks, images and formatting show as they'll be published, and
19
+ * turn into Markdown where the cursor is. `source`: plain Markdown throughout.
20
+ */
21
+ mode?: "live" | "source";
22
+ /** Uploads a pasted, dropped or picked file and resolves to its URL. Enables file insertion. */
23
+ upload?: (file: File) => Promise<string>;
24
+ /** Suggests link targets as the author types `](`, e.g. the site's pages matching `query`. */
25
+ links?: (query: string) => LinkSuggestion[] | Promise<LinkSuggestion[]>;
26
+ /** Languages for highlighting fenced code, e.g. `languages` from `@codemirror/language-data`. */
27
+ codeLanguages?: readonly LanguageDescription[];
28
+ /** Extra CodeMirror extensions. Read once, on mount. */
29
+ extensions?: Extension;
30
+ };
31
+ type __VLS_ModelProps = {
32
+ modelValue?: string;
33
+ };
34
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
35
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
36
+ /** True once CodeMirror has replaced the server-rendered fallback. */
37
+ ready: import("vue").ShallowRef<boolean, boolean>;
38
+ /** Formatting at the cursor. */
39
+ active: import("vue").ShallowRef<ReadonlySet<CommandName>, ReadonlySet<CommandName>>;
40
+ /** Whether files can be inserted (an `upload` is set). */
41
+ canUpload: import("vue").ComputedRef<boolean>;
42
+ canUndo: import("vue").ShallowRef<boolean, boolean>;
43
+ canRedo: import("vue").ShallowRef<boolean, boolean>;
44
+ /**
45
+ * Uploads in progress. Until they finish, their files are placeholders in the
46
+ * Markdown: wait for 0 before saving.
47
+ */
48
+ uploading: import("vue").ShallowRef<number, number>;
49
+ /** Applies a command. `image` opens the file picker with uploads, else inserts an empty image. */
50
+ run(command: CommandName): boolean;
51
+ /** Replaces the selection with `text`. */
52
+ insert: (text: string) => void | undefined;
53
+ /** Uploads and inserts files at the cursor. */
54
+ insertFiles: (files: readonly File[]) => boolean;
55
+ focus: () => void;
56
+ /** The CodeMirror view, for anything else. */
57
+ view: () => EditorView | undefined;
58
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
59
+ blur: () => any;
60
+ focus: () => any;
61
+ "update:modelValue": (value: string) => any;
62
+ uploadError: (error: unknown, file: File) => any;
63
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
64
+ onBlur?: (() => any) | undefined;
65
+ onFocus?: (() => any) | undefined;
66
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
67
+ onUploadError?: ((error: unknown, file: File) => any) | undefined;
68
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
69
+ declare const _default: typeof __VLS_export;
70
+ export { _default as default };