latex-cite-editor 0.1.2

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.
@@ -0,0 +1,37 @@
1
+ import * as react from 'react';
2
+ import { EditorView } from '@codemirror/view';
3
+ import { B as BibEntry } from './bibtex-BV8HliUE.js';
4
+
5
+ interface CiteEditorProps {
6
+ value: string;
7
+ onChange: (value: string) => void;
8
+ /** Parsed .bib entries used to power \cite{} autocomplete; pass the output of parseBibtex(). */
9
+ bibEntries?: BibEntry[];
10
+ fontSize?: number;
11
+ className?: string;
12
+ placeholder?: string;
13
+ minHeight?: string;
14
+ }
15
+ /**
16
+ * Imperative API for host toolbars that need to manipulate the document the
17
+ * way a `<textarea>` toolbar would (wrap selection, insert at line start, ...)
18
+ * without reaching into CodeMirror internals themselves.
19
+ */
20
+ interface CiteEditorHandle {
21
+ view: EditorView | null;
22
+ focus(): void;
23
+ getSelection(): string;
24
+ /** Wraps every selection range with `before`/`after`; empty ranges use `placeholder` as the wrapped text. */
25
+ wrapSelection(before: string, after: string, placeholder?: string): void;
26
+ /** Inserts `prefix` at the start of the line containing the cursor. */
27
+ insertAtLineStart(prefix: string): void;
28
+ /** Inserts `text` at the cursor, replacing any selection. */
29
+ insertText(text: string): void;
30
+ /** Duplicates the line containing the cursor, matching the common editor Ctrl+D shortcut. */
31
+ duplicateCurrentLine(): void;
32
+ /** Opens CodeMirror's built-in search & replace panel. */
33
+ openSearch(): void;
34
+ }
35
+ declare const CiteEditor: react.ForwardRefExoticComponent<CiteEditorProps & react.RefAttributes<CiteEditorHandle>>;
36
+
37
+ export { CiteEditor, type CiteEditorHandle, type CiteEditorProps };
package/dist/react.js ADDED
@@ -0,0 +1,158 @@
1
+ "use client";
2
+ import {
3
+ citationCompletionSource,
4
+ latexCommandCompletionSource,
5
+ latexHighlightPlugin,
6
+ latexHighlightTheme
7
+ } from "./chunk-5AWY4EOD.js";
8
+
9
+ // src/CiteEditor.tsx
10
+ import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
11
+ import { Compartment, EditorSelection, EditorState } from "@codemirror/state";
12
+ import { EditorView, keymap, highlightActiveLine, lineNumbers, placeholder as placeholderExt } from "@codemirror/view";
13
+ import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
14
+ import { markdown } from "@codemirror/lang-markdown";
15
+ import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
16
+ import { autocompletion, closeBrackets, closeBracketsKeymap, completionKeymap } from "@codemirror/autocomplete";
17
+ import { openSearchPanel, search, searchKeymap } from "@codemirror/search";
18
+ import { jsx } from "react/jsx-runtime";
19
+ function fontSizeTheme(fontSize, minHeight) {
20
+ return EditorView.theme({
21
+ "&": { fontSize: `${fontSize}px`, height: "100%" },
22
+ ".cm-scroller": { fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", minHeight },
23
+ ".cm-content": { padding: "12px 0" }
24
+ });
25
+ }
26
+ var CiteEditor = forwardRef(function CiteEditor2({ value, onChange, bibEntries = [], fontSize = 14, className, placeholder, minHeight = "500px" }, ref) {
27
+ const containerRef = useRef(null);
28
+ const viewRef = useRef(null);
29
+ const bibEntriesRef = useRef(bibEntries);
30
+ bibEntriesRef.current = bibEntries;
31
+ const onChangeRef = useRef(onChange);
32
+ onChangeRef.current = onChange;
33
+ const [themeCompartment] = useState(() => new Compartment());
34
+ useImperativeHandle(
35
+ ref,
36
+ () => ({
37
+ get view() {
38
+ return viewRef.current;
39
+ },
40
+ focus() {
41
+ viewRef.current?.focus();
42
+ },
43
+ getSelection() {
44
+ const view = viewRef.current;
45
+ if (!view) return "";
46
+ return view.state.sliceDoc(view.state.selection.main.from, view.state.selection.main.to);
47
+ },
48
+ wrapSelection(before, after, placeholderText = "") {
49
+ const view = viewRef.current;
50
+ if (!view) return;
51
+ const { state } = view;
52
+ const changes = state.changeByRange((range) => {
53
+ const selected = state.sliceDoc(range.from, range.to) || placeholderText;
54
+ const insert = `${before}${selected}${after}`;
55
+ return {
56
+ changes: { from: range.from, to: range.to, insert },
57
+ range: EditorSelection.range(range.from + before.length, range.from + before.length + selected.length)
58
+ };
59
+ });
60
+ view.dispatch(state.update(changes, { scrollIntoView: true }));
61
+ view.focus();
62
+ },
63
+ insertAtLineStart(prefix) {
64
+ const view = viewRef.current;
65
+ if (!view) return;
66
+ const { state } = view;
67
+ const changes = state.changeByRange((range) => {
68
+ const line = state.doc.lineAt(range.from);
69
+ return {
70
+ changes: { from: line.from, to: line.from, insert: prefix },
71
+ range: EditorSelection.range(range.from + prefix.length, range.to + prefix.length)
72
+ };
73
+ });
74
+ view.dispatch(state.update(changes, { scrollIntoView: true }));
75
+ view.focus();
76
+ },
77
+ insertText(text) {
78
+ const view = viewRef.current;
79
+ if (!view) return;
80
+ const { state } = view;
81
+ const changes = state.changeByRange((range) => ({
82
+ changes: { from: range.from, to: range.to, insert: text },
83
+ range: EditorSelection.cursor(range.from + text.length)
84
+ }));
85
+ view.dispatch(state.update(changes, { scrollIntoView: true }));
86
+ view.focus();
87
+ },
88
+ duplicateCurrentLine() {
89
+ const view = viewRef.current;
90
+ if (!view) return;
91
+ const line = view.state.doc.lineAt(view.state.selection.main.head);
92
+ view.dispatch({
93
+ changes: { from: line.to, to: line.to, insert: "\n" + line.text },
94
+ scrollIntoView: true
95
+ });
96
+ view.focus();
97
+ },
98
+ openSearch() {
99
+ const view = viewRef.current;
100
+ if (!view) return;
101
+ openSearchPanel(view);
102
+ }
103
+ }),
104
+ []
105
+ );
106
+ useEffect(() => {
107
+ if (!containerRef.current) return;
108
+ const extensions = [
109
+ lineNumbers(),
110
+ history(),
111
+ highlightActiveLine(),
112
+ markdown(),
113
+ syntaxHighlighting(defaultHighlightStyle),
114
+ latexHighlightPlugin,
115
+ latexHighlightTheme,
116
+ closeBrackets(),
117
+ search({ top: true }),
118
+ autocompletion({
119
+ override: [citationCompletionSource(() => bibEntriesRef.current), latexCommandCompletionSource]
120
+ }),
121
+ keymap.of([...closeBracketsKeymap, ...defaultKeymap, ...historyKeymap, ...completionKeymap, ...searchKeymap]),
122
+ EditorView.lineWrapping,
123
+ EditorView.updateListener.of((update) => {
124
+ if (update.docChanged) {
125
+ onChangeRef.current(update.state.doc.toString());
126
+ }
127
+ }),
128
+ themeCompartment.of(fontSizeTheme(fontSize, minHeight)),
129
+ ...placeholder ? [placeholderExt(placeholder)] : []
130
+ ];
131
+ const state = EditorState.create({ doc: value, extensions });
132
+ const view = new EditorView({ state, parent: containerRef.current });
133
+ viewRef.current = view;
134
+ return () => {
135
+ view.destroy();
136
+ viewRef.current = null;
137
+ };
138
+ }, []);
139
+ useEffect(() => {
140
+ const view = viewRef.current;
141
+ if (!view) return;
142
+ const current = view.state.doc.toString();
143
+ if (current !== value) {
144
+ view.dispatch({ changes: { from: 0, to: current.length, insert: value } });
145
+ }
146
+ }, [value]);
147
+ useEffect(() => {
148
+ const view = viewRef.current;
149
+ if (!view) return;
150
+ view.dispatch({ effects: themeCompartment.reconfigure(fontSizeTheme(fontSize, minHeight)) });
151
+ }, [fontSize, minHeight, themeCompartment]);
152
+ return /* @__PURE__ */ jsx("div", { ref: containerRef, className });
153
+ });
154
+ var CiteEditor_default = CiteEditor;
155
+ export {
156
+ CiteEditor_default as CiteEditor
157
+ };
158
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/CiteEditor.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { Compartment, EditorSelection, EditorState, type Extension } from '@codemirror/state';\nimport { EditorView, keymap, highlightActiveLine, lineNumbers, placeholder as placeholderExt } from '@codemirror/view';\nimport { defaultKeymap, history, historyKeymap } from '@codemirror/commands';\nimport { markdown } from '@codemirror/lang-markdown';\nimport { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';\nimport { autocompletion, closeBrackets, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';\nimport { openSearchPanel, search, searchKeymap } from '@codemirror/search';\nimport type { BibEntry } from './bibtex';\nimport { latexHighlightPlugin, latexHighlightTheme } from './latexDecorations';\nimport { citationCompletionSource, latexCommandCompletionSource } from './autocomplete';\n\nexport interface CiteEditorProps {\n value: string;\n onChange: (value: string) => void;\n /** Parsed .bib entries used to power \\cite{} autocomplete; pass the output of parseBibtex(). */\n bibEntries?: BibEntry[];\n fontSize?: number;\n className?: string;\n placeholder?: string;\n minHeight?: string;\n}\n\n/**\n * Imperative API for host toolbars that need to manipulate the document the\n * way a `<textarea>` toolbar would (wrap selection, insert at line start, ...)\n * without reaching into CodeMirror internals themselves.\n */\nexport interface CiteEditorHandle {\n view: EditorView | null;\n focus(): void;\n getSelection(): string;\n /** Wraps every selection range with `before`/`after`; empty ranges use `placeholder` as the wrapped text. */\n wrapSelection(before: string, after: string, placeholder?: string): void;\n /** Inserts `prefix` at the start of the line containing the cursor. */\n insertAtLineStart(prefix: string): void;\n /** Inserts `text` at the cursor, replacing any selection. */\n insertText(text: string): void;\n /** Duplicates the line containing the cursor, matching the common editor Ctrl+D shortcut. */\n duplicateCurrentLine(): void;\n /** Opens CodeMirror's built-in search & replace panel. */\n openSearch(): void;\n}\n\nfunction fontSizeTheme(fontSize: number, minHeight: string): Extension {\n return EditorView.theme({\n '&': { fontSize: `${fontSize}px`, height: '100%' },\n '.cm-scroller': { fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace', minHeight },\n '.cm-content': { padding: '12px 0' },\n });\n}\n\nconst CiteEditor = forwardRef<CiteEditorHandle, CiteEditorProps>(function CiteEditor(\n { value, onChange, bibEntries = [], fontSize = 14, className, placeholder, minHeight = '500px' },\n ref\n) {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const viewRef = useRef<EditorView | null>(null);\n const bibEntriesRef = useRef(bibEntries);\n bibEntriesRef.current = bibEntries;\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const [themeCompartment] = useState(() => new Compartment());\n\n useImperativeHandle(\n ref,\n () => ({\n get view() {\n return viewRef.current;\n },\n focus() {\n viewRef.current?.focus();\n },\n getSelection() {\n const view = viewRef.current;\n if (!view) return '';\n return view.state.sliceDoc(view.state.selection.main.from, view.state.selection.main.to);\n },\n wrapSelection(before, after, placeholderText = '') {\n const view = viewRef.current;\n if (!view) return;\n const { state } = view;\n const changes = state.changeByRange((range) => {\n const selected = state.sliceDoc(range.from, range.to) || placeholderText;\n const insert = `${before}${selected}${after}`;\n return {\n changes: { from: range.from, to: range.to, insert },\n range: EditorSelection.range(range.from + before.length, range.from + before.length + selected.length),\n };\n });\n view.dispatch(state.update(changes, { scrollIntoView: true }));\n view.focus();\n },\n insertAtLineStart(prefix) {\n const view = viewRef.current;\n if (!view) return;\n const { state } = view;\n const changes = state.changeByRange((range) => {\n const line = state.doc.lineAt(range.from);\n return {\n changes: { from: line.from, to: line.from, insert: prefix },\n range: EditorSelection.range(range.from + prefix.length, range.to + prefix.length),\n };\n });\n view.dispatch(state.update(changes, { scrollIntoView: true }));\n view.focus();\n },\n insertText(text) {\n const view = viewRef.current;\n if (!view) return;\n const { state } = view;\n const changes = state.changeByRange((range) => ({\n changes: { from: range.from, to: range.to, insert: text },\n range: EditorSelection.cursor(range.from + text.length),\n }));\n view.dispatch(state.update(changes, { scrollIntoView: true }));\n view.focus();\n },\n duplicateCurrentLine() {\n const view = viewRef.current;\n if (!view) return;\n const line = view.state.doc.lineAt(view.state.selection.main.head);\n view.dispatch({\n changes: { from: line.to, to: line.to, insert: '\\n' + line.text },\n scrollIntoView: true,\n });\n view.focus();\n },\n openSearch() {\n const view = viewRef.current;\n if (!view) return;\n openSearchPanel(view);\n },\n }),\n []\n );\n\n useEffect(() => {\n if (!containerRef.current) return;\n\n const extensions: Extension[] = [\n lineNumbers(),\n history(),\n highlightActiveLine(),\n markdown(),\n syntaxHighlighting(defaultHighlightStyle),\n latexHighlightPlugin,\n latexHighlightTheme,\n closeBrackets(),\n search({ top: true }),\n autocompletion({\n override: [citationCompletionSource(() => bibEntriesRef.current), latexCommandCompletionSource],\n }),\n keymap.of([...closeBracketsKeymap, ...defaultKeymap, ...historyKeymap, ...completionKeymap, ...searchKeymap]),\n EditorView.lineWrapping,\n EditorView.updateListener.of((update) => {\n if (update.docChanged) {\n onChangeRef.current(update.state.doc.toString());\n }\n }),\n themeCompartment.of(fontSizeTheme(fontSize, minHeight)),\n ...(placeholder ? [placeholderExt(placeholder)] : []),\n ];\n\n const state = EditorState.create({ doc: value, extensions });\n const view = new EditorView({ state, parent: containerRef.current });\n viewRef.current = view;\n\n return () => {\n view.destroy();\n viewRef.current = null;\n };\n // Mount once; external `value` changes are synced via the effect below instead of\n // recreating the view (which would drop cursor position/undo history on every keystroke).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n const view = viewRef.current;\n if (!view) return;\n const current = view.state.doc.toString();\n if (current !== value) {\n view.dispatch({ changes: { from: 0, to: current.length, insert: value } });\n }\n }, [value]);\n\n useEffect(() => {\n const view = viewRef.current;\n if (!view) return;\n view.dispatch({ effects: themeCompartment.reconfigure(fontSizeTheme(fontSize, minHeight)) });\n }, [fontSize, minHeight, themeCompartment]);\n\n return <div ref={containerRef} className={className} />;\n});\n\nexport default CiteEditor;\n"],"mappings":";;;;;;;;;AAEA,SAAS,YAAY,WAAW,qBAAqB,QAAQ,gBAAgB;AAC7E,SAAS,aAAa,iBAAiB,mBAAmC;AAC1E,SAAS,YAAY,QAAQ,qBAAqB,aAAa,eAAe,sBAAsB;AACpG,SAAS,eAAe,SAAS,qBAAqB;AACtD,SAAS,gBAAgB;AACzB,SAAS,uBAAuB,0BAA0B;AAC1D,SAAS,gBAAgB,eAAe,qBAAqB,wBAAwB;AACrF,SAAS,iBAAiB,QAAQ,oBAAoB;AAyL7C;AApJT,SAAS,cAAc,UAAkB,WAA8B;AACrE,SAAO,WAAW,MAAM;AAAA,IACtB,KAAK,EAAE,UAAU,GAAG,QAAQ,MAAM,QAAQ,OAAO;AAAA,IACjD,gBAAgB,EAAE,YAAY,kDAAkD,UAAU;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AU,KAAK,MAAM,IAAI,SAAS;AACxC,QAAI,YAAY,OAAO;AACrB,WAAK,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,QAAQ,QAAQ,QAAQ,MAAM,EAAE,CAAC;AAAA,IAC3E;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,YAAU,MAAM;AACd,UAAM,OAAO,QAAQ;AACrB,QAAI,CAAC,KAAM;AACX,SAAK,SAAS,EAAE,SAAS,iBAAiB,YAAY,cAAc,UAAU,SAAS,CAAC,EAAE,CAAC;AAAA,EAC7F,GAAG,CAAC,UAAU,WAAW,gBAAgB,CAAC;AAE1C,SAAO,oBAAC,SAAI,KAAK,cAAc,WAAsB;AACvD,CAAC;AAED,IAAO,qBAAQ;","names":["CiteEditor"]}
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "latex-cite-editor",
3
+ "version": "0.1.2",
4
+ "description": "A CodeMirror 6 based React editor with LaTeX-style \\cite{} bibliography autocomplete backed by BibTeX (.bib) files",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./react": {
16
+ "types": "./dist/react.d.ts",
17
+ "import": "./dist/react.js",
18
+ "require": "./dist/react.cjs"
19
+ }
20
+ },
21
+ "scripts": {
22
+ "build": "tsup",
23
+ "dev": "tsup --watch",
24
+ "lint": "tsc --noEmit",
25
+ "typecheck": "tsc --noEmit",
26
+ "prepublishOnly": "npm run build"
27
+ },
28
+ "keywords": [
29
+ "react",
30
+ "nextjs",
31
+ "codemirror",
32
+ "latex",
33
+ "bibtex",
34
+ "citation",
35
+ "bibliography",
36
+ "markdown",
37
+ "editor",
38
+ "autocomplete"
39
+ ],
40
+ "author": "ReinanBr",
41
+ "license": "MIT",
42
+ "engines": {
43
+ "node": ">=18"
44
+ },
45
+ "peerDependencies": {
46
+ "react": ">=18",
47
+ "react-dom": ">=18"
48
+ },
49
+ "dependencies": {
50
+ "@codemirror/autocomplete": "^6.18.6",
51
+ "@codemirror/commands": "^6.8.1",
52
+ "@codemirror/lang-markdown": "^6.3.4",
53
+ "@codemirror/language": "^6.11.3",
54
+ "@codemirror/search": "^6.5.11",
55
+ "@codemirror/state": "^6.5.2",
56
+ "@codemirror/view": "^6.38.6",
57
+ "@lezer/highlight": "^1.2.1"
58
+ },
59
+ "devDependencies": {
60
+ "@types/react": "^19",
61
+ "@types/react-dom": "^19",
62
+ "react": "^19",
63
+ "react-dom": "^19",
64
+ "tsup": "^8.3.5",
65
+ "typescript": "^5.8.2"
66
+ },
67
+ "files": [
68
+ "dist",
69
+ "README.md",
70
+ "LICENSE"
71
+ ],
72
+ "repository": {
73
+ "type": "git",
74
+ "url": "https://github.com/reinanbr/latex-cite-editor"
75
+ }
76
+ }