@docx-editor.dev/editor-api 2.0.1 → 2.1.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 +27 -28
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -26,10 +26,10 @@ already has open in a page.
26
26
  npm install @docx-editor.dev/editor-api
27
27
  ```
28
28
 
29
- ## On a server, from bytes
29
+ ## On a server
30
30
 
31
- No browser, no framework, nothing to mount. This half of the package opens DOCX bytes, edits
32
- them, and hands them back.
31
+ The default entry needs no browser and nothing to mount. It opens DOCX bytes, edits them, and
32
+ hands them back.
33
33
 
34
34
  ```ts
35
35
  import { readFile, writeFile } from 'node:fs/promises';
@@ -55,12 +55,11 @@ try {
55
55
  }
56
56
  ```
57
57
 
58
- ## In a page, on a document already open
58
+ ## In the browser
59
59
 
60
- The browser entry takes an editor the host already created — from `@docx-editor.dev/react`,
61
- `@docx-editor.dev/react` or a plain page — and drives it in place, so edits land in the open
62
- document with the reader's undo stack intact. There is no `save()`: the host saves as it already
63
- did.
60
+ The browser entry takes an editor the host already created, from `@docx-editor.dev/react` or a
61
+ plain page, and drives it in place. Edits land in the open document with the reader's undo
62
+ stack intact. There is no `save()`: the host saves as it already did.
64
63
 
65
64
  ```ts
66
65
  import { DocxEditor } from '@docx-editor.dev/editor-api/browser';
@@ -79,20 +78,20 @@ await runtime.run(async (context) => {
79
78
  Import it from `/browser` deliberately: reaching a live editor means reaching the painted engine,
80
79
  and a server holding bytes should not pay for that.
81
80
 
82
- ## The four rules
81
+ ## Programming model
83
82
 
84
- - **Read what you asked for.** A property you did not `load()` throws instead of answering
85
- `undefined`, so a typo fails at the read rather than producing a wrong document later.
86
- - **`sync()` is the only round trip.** Everything queued between two syncs is one ordered batch,
83
+ - A property you did not `load()` throws instead of answering `undefined`, so a typo fails at
84
+ the read rather than producing a wrong document later.
85
+ - `sync()` is the only round trip. Everything queued between two syncs is one ordered batch,
87
86
  applied atomically.
88
- - **Objects live inside `run`.** They are proxies into a document the runtime owns. Keeping one
89
- past the callback, or past `dispose()`, is an error rather than a stale read — to keep one
90
- across syncs deliberately, hand it to `context.trackedObjects`.
91
- - **Ask before you assume.** `getFirstOrNullObject` / `getLastOrNullObject` answer an object whose
92
- `isNullObject` is `true`, which is the difference between "no such heading" and a crash.
93
-
94
- `runtime.capabilities` says what the host behind a runtime can do — `save` is false in the
95
- browser; `selection`, `scrolling` and `layout` are false on a server — and it is frozen for the
87
+ - Objects are proxies into a document the runtime owns and live inside `run`. Keeping one past
88
+ the callback, or past `dispose()`, is an error rather than a stale read; to keep one across
89
+ syncs deliberately, hand it to `context.trackedObjects`.
90
+ - `getFirstOrNullObject` / `getLastOrNullObject` answer an object whose `isNullObject` is
91
+ `true`, which is the difference between "no such heading" and a crash.
92
+
93
+ `runtime.capabilities` says what the host behind a runtime can do: `save` is false in the
94
+ browser; `selection`, `scrolling` and `layout` are false on a server. It is frozen for the
96
95
  life of the runtime, so one read stays true.
97
96
 
98
97
  ## Entries
@@ -105,16 +104,16 @@ life of the runtime, so one read stays true.
105
104
  Both entries export the same vocabulary — the lifecycle types, the object model and the error
106
105
  type — so consumer code compiles against either. They differ by one member: `createBrowser`.
107
106
 
108
- ## What this is, and is not
107
+ ## Office.js compatibility
109
108
 
110
- The Office.js Word-shaped DocxEditor API is compatible with a documented subset of Word's
111
- JavaScript object model, so a call site written against that vocabulary compiles here. It is not
112
- Office.js, does not run in an Office add-in host, and depends on no Microsoft package. Every type
113
- in the surface is authored in this repository.
109
+ The API is compatible with a documented subset of Word's JavaScript object model, so a call
110
+ site written against that vocabulary compiles here. It is not Office.js: it does not run in an
111
+ Office add-in host and depends on no Microsoft package. Every type in the surface is authored
112
+ in this repository.
114
113
 
115
- The supported subset and its documented omissions — tables, images, repeating sections, custom
116
- XML mapping — are listed in
117
- [the Word API compatibility page](https://www.docx-editor.dev/docs/1.x/editor-api/word-js-api).
114
+ The supported subset and its documented omissions (tables, images, repeating sections, custom
115
+ XML mapping) are listed in
116
+ [the Office.js compatibility page](https://www.docx-editor.dev/docs/latest/editor-api/office-js-api).
118
117
 
119
118
  Upgrading from the reviewer/bridge/MCP/chat surfaces this package used to ship? See
120
119
  [MIGRATION.md](https://github.com/eigenpal/docx-editor/blob/main/packages/editor-api/MIGRATION.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docx-editor.dev/editor-api",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "Document automation for DOCX: a batching object model that drives a document from a server or from an editor already open in a page",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -73,6 +73,6 @@
73
73
  "access": "public"
74
74
  },
75
75
  "dependencies": {
76
- "@docx-editor.dev/core": "^2.0.1"
76
+ "@docx-editor.dev/core": "^2.1.0"
77
77
  }
78
78
  }