logisheets-formula-editor 1.8.0 → 1.9.0

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 (2) hide show
  1. package/README.md +33 -7
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,9 @@
1
- # logisheets-formula-editor-react
1
+ # logisheets-formula-editor
2
2
 
3
- A React component for editing spreadsheet formulas with syntax highlighting and autocomplete, built on [CodeMirror 6](https://codemirror.net/).
3
+ A formula editor for spreadsheets with syntax highlighting and autocomplete,
4
+ built on [CodeMirror 6](https://codemirror.net/). Ships a React component at the
5
+ package root and a **framework-agnostic core** (`/core`) usable from vanilla JS,
6
+ Vue, Svelte, Angular, etc.
4
7
 
5
8
  ## Features
6
9
 
@@ -28,14 +31,16 @@ This design ensures:
28
31
  ## Installation
29
32
 
30
33
  ```bash
31
- # From the LogiSheets root directory
32
- yarn install
34
+ npm install logisheets-formula-editor
33
35
  ```
34
36
 
35
- ## Usage
37
+ For the React component (package root), `react` and `react-dom` are peer
38
+ dependencies. The `/core` entry has no framework dependency.
39
+
40
+ ## Usage (React)
36
41
 
37
42
  ```tsx
38
- import { FormulaEditor, FormulaDisplayInfo, FormulaFunction } from 'logisheets-formula-editor-react'
43
+ import { FormulaEditor, FormulaDisplayInfo, FormulaFunction } from 'logisheets-formula-editor'
39
44
 
40
45
  // Define available functions for autocomplete
41
46
  const functions: FormulaFunction[] = [
@@ -110,6 +115,27 @@ interface FormulaEditorConfig {
110
115
  }
111
116
  ```
112
117
 
118
+ ## Framework-agnostic core
119
+
120
+ The React `<FormulaEditor>` is a thin wrapper over a framework-free core. To use
121
+ it from vanilla JS (or Vue, Svelte, Angular, …), import from the `/core` subpath
122
+ and mount it onto a DOM element — the same pattern as `logisheets-engine`:
123
+
124
+ ```ts
125
+ import {createFormulaEditor} from 'logisheets-formula-editor/core'
126
+ import 'logisheets-formula-editor/styles.css'
127
+
128
+ const editor = createFormulaEditor(el, {
129
+ getDisplayUnits, // same backend callback as the React prop
130
+ formulaFunctions,
131
+ // fontSize, textAlign, wordWrap, onChange, onSubmit, …
132
+ })
133
+ ```
134
+
135
+ The core exposes `FormulaEditorHandle` / `FormulaEditorOptions`. Additional
136
+ subpaths: `/engine` (LogiSheets engine integration) and `/inline` (inline editing
137
+ variant).
138
+
113
139
  ## Keyboard Shortcuts
114
140
 
115
141
  | Key | Action |
@@ -138,7 +164,7 @@ We use CodeMirror 6 instead of a custom canvas-based editor because it provides:
138
164
 
139
165
  ```bash
140
166
  # Start the demo app
141
- cd packages/formula-editor-react
167
+ cd packages/formula-editor
142
168
  yarn dev
143
169
 
144
170
  # Open http://localhost:5173
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logisheets-formula-editor",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",