@docx-editor.dev/core 0.0.1 → 2.0.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.
- package/LICENSE +201 -0
- package/README.md +92 -2
- package/THIRD_PARTY_NOTICES.md +18 -0
- package/dist/automation.cjs +1 -0
- package/dist/automation.d.cts +74 -0
- package/dist/automation.d.ts +74 -0
- package/dist/automation.js +1 -0
- package/dist/binding.cjs +1 -0
- package/dist/binding.d.cts +82 -0
- package/dist/binding.d.ts +82 -0
- package/dist/binding.js +1 -0
- package/dist/chunk-5KSCB2OZ.js +2 -0
- package/dist/chunk-BSC44TIT.js +5 -0
- package/dist/chunk-DLPL5DAG.js +12 -0
- package/dist/chunk-DOEIARE2.js +2 -0
- package/dist/chunk-G7YCQBZE.cjs +5 -0
- package/dist/chunk-HBL3NNH5.cjs +1 -0
- package/dist/chunk-HR7K3W6A.js +1 -0
- package/dist/chunk-HVAV2JSN.js +11 -0
- package/dist/chunk-MYH2HCUJ.cjs +2 -0
- package/dist/chunk-NSM75TN6.cjs +1 -0
- package/dist/chunk-PHDVKUWZ.js +1 -0
- package/dist/chunk-QADYGK5L.cjs +12 -0
- package/dist/chunk-REZUWYB7.js +1 -0
- package/dist/chunk-RNBHTPW7.js +10 -0
- package/dist/chunk-UD2ZXLFI.cjs +2 -0
- package/dist/chunk-VYAVK2AH.cjs +1 -0
- package/dist/chunk-YUK46A2N.cjs +11 -0
- package/dist/chunk-ZMIX42J7.cjs +10 -0
- package/dist/chunk-ZT55Q52J.cjs +2 -0
- package/dist/chunk-ZUALAR4M.js +2 -0
- package/dist/content-control-walk-CbTqHq6O.d.cts +56 -0
- package/dist/content-control-walk-D06GijR0.d.ts +56 -0
- package/dist/contracts/document.cjs +1 -0
- package/dist/contracts/document.d.cts +246 -0
- package/dist/contracts/document.d.ts +246 -0
- package/dist/contracts/document.js +0 -0
- package/dist/contracts/editor.cjs +1 -0
- package/dist/contracts/editor.d.cts +11 -0
- package/dist/contracts/editor.d.ts +11 -0
- package/dist/contracts/editor.js +1 -0
- package/dist/contracts/interaction.cjs +1 -0
- package/dist/contracts/interaction.d.cts +11 -0
- package/dist/contracts/interaction.d.ts +11 -0
- package/dist/contracts/interaction.js +0 -0
- package/dist/contracts/modules.cjs +1 -0
- package/dist/contracts/modules.d.cts +90 -0
- package/dist/contracts/modules.d.ts +90 -0
- package/dist/contracts/modules.js +1 -0
- package/dist/contracts/types.cjs +1 -0
- package/dist/contracts/types.d.cts +452 -0
- package/dist/contracts/types.d.ts +452 -0
- package/dist/contracts/types.js +0 -0
- package/dist/editor-C1QRi1v4.d.ts +1671 -0
- package/dist/editor-D0UDock4.d.cts +1671 -0
- package/dist/editor.cjs +1 -0
- package/dist/editor.css +6017 -0
- package/dist/editor.d.cts +271 -0
- package/dist/editor.d.ts +271 -0
- package/dist/editor.js +1 -0
- package/dist/hf-references-BdjsQNE_.d.ts +71 -0
- package/dist/hf-references-CgEOSw3i.d.cts +71 -0
- package/dist/image-resources-BJnTpG66.d.ts +195 -0
- package/dist/image-resources-BpIydXtU.d.cts +195 -0
- package/dist/index-CrW-IxXt.d.cts +2515 -0
- package/dist/index-ZqBEOrTV.d.ts +2515 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +1 -0
- package/dist/layout.cjs +1 -0
- package/dist/layout.d.cts +2316 -0
- package/dist/layout.d.ts +2316 -0
- package/dist/layout.js +1 -0
- package/dist/note-nodes-BPSTVDMr.d.ts +108 -0
- package/dist/note-nodes-C6DLxlvj.d.cts +108 -0
- package/dist/note-properties-CnmCoory.d.cts +68 -0
- package/dist/note-properties-m75hmP70.d.ts +68 -0
- package/dist/ooxml-package-CR5us6ad.d.cts +354 -0
- package/dist/ooxml-package-D_CtywTW.d.ts +354 -0
- package/dist/ooxml-tree-BU0e3DVi.d.cts +871 -0
- package/dist/ooxml-tree-BU0e3DVi.d.ts +871 -0
- package/dist/output.cjs +1 -0
- package/dist/output.d.cts +158 -0
- package/dist/output.d.ts +158 -0
- package/dist/output.js +1 -0
- package/dist/protocol-CAkOBBGE.d.cts +1201 -0
- package/dist/protocol-oxHaWmt4.d.ts +1201 -0
- package/dist/review-support-DS8DYX2a.d.cts +326 -0
- package/dist/review-support-Fy3vdIea.d.ts +326 -0
- package/dist/revision-projection-72ZApe-g.d.cts +84 -0
- package/dist/revision-projection-DHAkcD_L.d.ts +84 -0
- package/dist/semantic-cell-selection-CZjBSmMv.d.cts +427 -0
- package/dist/semantic-cell-selection-DsmHmLJ5.d.ts +427 -0
- package/dist/semantic-interaction-D-Dszxrn.d.cts +187 -0
- package/dist/semantic-interaction-Dy-dCUFF.d.ts +187 -0
- package/dist/semantic-paint-drawings-BA3z9jl8.d.ts +21 -0
- package/dist/semantic-paint-drawings-D7qbB0E2.d.cts +21 -0
- package/dist/semantic-records-CJR3BvHs.d.cts +1432 -0
- package/dist/semantic-records-CWodBJsz.d.ts +1432 -0
- package/dist/shaped-measurer-B-TAtcQU.d.ts +613 -0
- package/dist/shaped-measurer-CNIT_svZ.d.cts +613 -0
- package/dist/store.cjs +1 -0
- package/dist/store.d.cts +2247 -0
- package/dist/store.d.ts +2247 -0
- package/dist/store.js +1 -0
- package/dist/tree-op-types-CwOeiaQ8.d.ts +1431 -0
- package/dist/tree-op-types-DMiW6nIH.d.cts +1431 -0
- package/dist/tree-package-store-D5S7VKs5.d.ts +708 -0
- package/dist/tree-package-store-DOKMtCnh.d.cts +708 -0
- package/dist/tree-session-CiUel5Kz.d.ts +542 -0
- package/dist/tree-session-D47_imvR.d.cts +542 -0
- package/dist/tree-store-CxifqwIv.d.cts +273 -0
- package/dist/tree-store-hLtjeyWE.d.ts +273 -0
- package/package.json +105 -8
- package/index.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 EigenPal Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,5 +1,95 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://www.docx-editor.dev/">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/eigenpal/docx-editor/main/.github/assets/header.png" alt="DOCX Editor — .docx in, .docx out. Open source, client-side." width="500" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@docx-editor.dev/core"><img src="https://img.shields.io/npm/v/@docx-editor.dev/core.svg?style=flat-square&color=3B5BDB" alt="npm version" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@docx-editor.dev/core"><img src="https://img.shields.io/npm/dm/@docx-editor.dev/core.svg?style=flat-square&color=3B5BDB" alt="npm downloads" /></a>
|
|
10
|
+
<a href="https://github.com/eigenpal/docx-editor/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache_2.0-blue.svg?style=flat-square&color=3B5BDB" alt="license" /></a>
|
|
11
|
+
<a href="https://www.docx-editor.dev/docs"><img src="https://img.shields.io/badge/Docs-3B5BDB?style=flat-square&logo=readthedocs&logoColor=white" alt="Documentation" /></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
1
14
|
# @docx-editor.dev/core
|
|
2
15
|
|
|
3
|
-
|
|
16
|
+
The engine behind [docx-editor.dev](https://docx-editor.dev). It reads a `.docx` into a
|
|
17
|
+
canonical document tree, lays that tree out into pages, paints them, and writes the tree back
|
|
18
|
+
to OOXML. No framework dependency and no UI.
|
|
19
|
+
|
|
20
|
+
Most apps never install this directly — [`@docx-editor.dev/react`](https://www.npmjs.com/package/@docx-editor.dev/react)
|
|
21
|
+
carries it. Reach for it when you are writing your own adapter, or when you need the contract
|
|
22
|
+
types to write a function signature.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @docx-editor.dev/core
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## The root is the 80% path
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { createDocxEditor, loadFonts, WORD_DEFAULT_FONT } from '@docx-editor.dev/core';
|
|
32
|
+
import type { Editor, EditorSnapshot } from '@docx-editor.dev/core';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Create an editor, the `Editor` contract it implements, fonts, the chrome registry, and the
|
|
36
|
+
document model types. Reach for a subpath when you need the canonical tree, the layout pass,
|
|
37
|
+
or the paint step directly.
|
|
38
|
+
|
|
39
|
+
| Subpath | What's there |
|
|
40
|
+
| ---------------------- | ------------------------------------------------------------------------------- |
|
|
41
|
+
| `.` | Create an editor, the contract, fonts, the chrome registry, the document model. |
|
|
42
|
+
| `./editor` | Everything the root re-exports, plus the paginated surface and ruler geometry. |
|
|
43
|
+
| `./contracts/editor` | `Editor`, `EditorCommand`, `EditorQuery`, `EditorSnapshot`, `PageSetup`. |
|
|
44
|
+
| `./contracts/document` | The document-level edit and query vocabulary. |
|
|
45
|
+
| `./contracts/types` | Document model types. |
|
|
46
|
+
| `./contracts/modules` | `EditorModule` — the shape `@docx-editor.dev/pro` implements. |
|
|
47
|
+
| `./store` | The canonical tree and its transactional store. |
|
|
48
|
+
| `./layout` | The DOM-free layout pass. |
|
|
49
|
+
| `./output` | Serialization. |
|
|
50
|
+
| `./automation` | The object model behind `@docx-editor.dev/editor-api`. |
|
|
51
|
+
| `./styles/editor.css` | The one editor stylesheet, shared by packaged and custom chrome. |
|
|
52
|
+
|
|
53
|
+
## Nothing is lost
|
|
54
|
+
|
|
55
|
+
Everything you do not edit comes back byte for byte, including parts the engine does not
|
|
56
|
+
model — custom XML, embedded fonts, macros, media, unknown extensions. Two oracles gate it in
|
|
57
|
+
CI: a canonical fingerprint over the tree, and a save-and-reopen semantic digest.
|
|
58
|
+
|
|
59
|
+
## One pipeline
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
bytes → bounded OPC/XML read → canonical OOXML tree → layout → painted pages → serialize
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
There is one document model. The painted pages are the editable surface: they are
|
|
66
|
+
`contenteditable`, but the DOM is a picture. Browser mutations are prevented and re-expressed
|
|
67
|
+
as tree operations, so the browser never invents markup inside your document.
|
|
68
|
+
|
|
69
|
+
Nodes are **typed** where layout needs them and **generic** everywhere else, preserving the
|
|
70
|
+
element verbatim. So content the engine does not model is carried rather than dropped, and a
|
|
71
|
+
document full of unknown extensions still opens, edits, and saves.
|
|
72
|
+
|
|
73
|
+
On save, modeled parts are re-emitted normalized; everything else — custom XML, embedded fonts,
|
|
74
|
+
media — is repacked from the original file untouched. Two oracles gate that in CI: a canonical
|
|
75
|
+
fingerprint over the tree, and a save-and-reopen semantic digest.
|
|
76
|
+
|
|
77
|
+
## Untrusted input
|
|
78
|
+
|
|
79
|
+
A `.docx` is a zip of XML that whoever sent it controls end to end. The engine sanitizes at the
|
|
80
|
+
parse boundary — URL allowlisting, entity and zip-bomb limits, recursion and element caps, no
|
|
81
|
+
zero-click external fetches, escaping on the way back out.
|
|
82
|
+
|
|
83
|
+
Anything you render from document data (a font name, a hyperlink target, a comment body) is
|
|
84
|
+
still attacker-controlled at your boundary. Render it as text; do not build markup or URLs
|
|
85
|
+
from it.
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
- [Core overview](https://www.docx-editor.dev/docs/2.x/core)
|
|
90
|
+
- [Architecture](https://www.docx-editor.dev/docs/2.x/core/architecture)
|
|
91
|
+
- [Word fidelity](https://www.docx-editor.dev/docs/2.x/word-fidelity)
|
|
92
|
+
|
|
93
|
+
## License
|
|
4
94
|
|
|
5
|
-
|
|
95
|
+
Apache-2.0
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`@docx-editor.dev/core` is distributed under Apache-2.0. Its published bundles also contain
|
|
4
|
+
source from the open-source packages listed below, redistributed here under
|
|
5
|
+
their own licenses, reproduced in full.
|
|
6
|
+
|
|
7
|
+
Those copies are not verbatim. The build inlines, minifies and tree-shakes
|
|
8
|
+
them, and includes only the parts each bundle reaches, so what ships is a
|
|
9
|
+
modified form of the original source.
|
|
10
|
+
|
|
11
|
+
This file covers code copied INTO the published bundles. Packages this one
|
|
12
|
+
declares as `dependencies` or `peerDependencies` are installed separately by
|
|
13
|
+
the consumer and are not repeated here.
|
|
14
|
+
|
|
15
|
+
Generated by `bun run notices:generate` from the build's esbuild metafile.
|
|
16
|
+
Do not edit by hand.
|
|
17
|
+
|
|
18
|
+
No third-party code is bundled into this package.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkNSM75TN6_cjs=require('./chunk-NSM75TN6.cjs'),chunkZMIX42J7_cjs=require('./chunk-ZMIX42J7.cjs');var y=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),C=Object.freeze({kind:"body"});function I(e,r={}){let t=chunkZMIX42J7_cjs.wb(e,r.limits??{});if(!t.ok)return {ok:false,reason:t.reason,...t.detail?{detail:t.detail}:{}};let o=t.package.parts.get(t.package.mainDocumentPart);if(!o)return {ok:false,reason:"no-main-document-part",detail:t.package.mainDocumentPart};let a=new chunkZMIX42J7_cjs.ef(t.package,chunkZMIX42J7_cjs.Mc(o));return {ok:true,host:chunkNSM75TN6_cjs.g({port:h(a),capabilities:y})}}function T(e,r,t){let o=e.partFor(t);if(!o)return null;let a=chunkZMIX42J7_cjs.Oc(e.currentPackage(),r,o.name);return a?(e.replacePackageShell(a.pkg),a.relationshipId):null}function h(e){let r=true;return {revision:()=>e.packageRevision,currentPackage:()=>r?e.currentPackage():null,apply(t,o=C){if(!r)return {ok:false,reason:"disposed"};let a=t(i=>T(e,i,o));if(a===null)return {ok:false,reason:"unsupported-target"};let n=e.transact(o,i=>{for(let f of a)i.apply(f);});return n.ok?{ok:true,changed:n.change!==null}:{ok:false,reason:n.detail?`${n.reason}: ${n.detail}`:n.reason}},applyLifecycle(t){if(!r)return {ok:false,reason:"disposed"};let o=e.applyLifecycleOp(t);return o.ok?{ok:true,changed:o.change!==null}:{ok:false,reason:o.detail?`${o.reason}: ${o.detail}`:o.reason}},applyCommentWrite(t,o){if(!r)return {ok:false,reason:"disposed"};let a=e.resolveStory(o);if(!a.ok)return {ok:false,reason:a.reason};a.store.graftPackage(()=>e.currentPackage());let n=t.kind==="reply"?chunkZMIX42J7_cjs.ff(a.store,{anchor:t.anchor,author:t.author,text:t.text,...t.date===void 0?{}:{date:t.date},replyToCommentId:t.parentCommentId}):chunkZMIX42J7_cjs.gf(a.store,t.commentId,t.resolved);return n.ok?(e.replacePackageShell(a.store.package),{ok:true,changed:true,..."commentId"in n?{commentId:n.commentId}:{}}):{ok:false,reason:n.reason}},save:()=>r?chunkZMIX42J7_cjs.xb(e.currentPackage()):null,subscribe:t=>e.subscribe(()=>t()),dispose(){r=false;}}}Object.defineProperty(exports,"AUTOMATION_COMMAND_OPERATIONS",{enumerable:true,get:function(){return chunkNSM75TN6_cjs.c}});Object.defineProperty(exports,"AUTOMATION_QUERY_OPERATIONS",{enumerable:true,get:function(){return chunkNSM75TN6_cjs.b}});Object.defineProperty(exports,"AUTOMATION_SOLITARY_OPERATIONS",{enumerable:true,get:function(){return chunkNSM75TN6_cjs.d}});Object.defineProperty(exports,"HEADER_FOOTER_VARIANTS",{enumerable:true,get:function(){return chunkNSM75TN6_cjs.a}});Object.defineProperty(exports,"isAutomationCommand",{enumerable:true,get:function(){return chunkNSM75TN6_cjs.f}});Object.defineProperty(exports,"isSolitaryAutomationCommand",{enumerable:true,get:function(){return chunkNSM75TN6_cjs.e}});exports.SERVER_AUTOMATION_CAPABILITIES=y;exports.createServerAutomationHost=I;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { A as AutomationCapabilities, a as AutomationHost } from './protocol-CAkOBBGE.cjs';
|
|
2
|
+
export { b as AUTOMATION_COMMAND_OPERATIONS, c as AUTOMATION_QUERY_OPERATIONS, d as AUTOMATION_SOLITARY_OPERATIONS, e as AutomationAlignment, f as AutomationBatchRequest, g as AutomationBatchResponse, h as AutomationChangeEvent, i as AutomationContentControlLock, j as AutomationContentControlRangeLocation, k as AutomationContentControlScope, l as AutomationContentControlSubtype, m as AutomationContentControlValue, n as AutomationError, o as AutomationErrorCode, p as AutomationFontRead, q as AutomationFontWrite, r as AutomationHandle, s as AutomationHandleRef, t as AutomationObjectKind, u as AutomationOperation, v as AutomationOperationKind, w as AutomationOperationResult, x as AutomationPageOrientation, y as AutomationPageSetupRead, z as AutomationPageSetupWrite, B as AutomationParagraphFormatRead, C as AutomationParagraphFormatWrite, D as AutomationParagraphRef, E as AutomationPoint, F as AutomationSaveResult, G as AutomationSearchOptions, H as AutomationSelectionMode, I as AutomationSpan, J as AutomationSpanRef, K as AutomationUnsubscribe, L as AutomationValue, M as isAutomationCommand, N as isSolitaryAutomationCommand } from './protocol-CAkOBBGE.cjs';
|
|
3
|
+
import { H as HeaderFooterVariant } from './hf-references-CgEOSw3i.cjs';
|
|
4
|
+
import { N as NoteKind } from './note-nodes-C6DLxlvj.cjs';
|
|
5
|
+
import { a as OoxmlPackageLimits, b as OoxmlPackageRejection } from './ooxml-package-CR5us6ad.cjs';
|
|
6
|
+
import './ooxml-tree-BU0e3DVi.cjs';
|
|
7
|
+
|
|
8
|
+
/** The variants a section can declare furniture for. */
|
|
9
|
+
declare const HEADER_FOOTER_VARIANTS: readonly HeaderFooterVariant[];
|
|
10
|
+
/**
|
|
11
|
+
* Which story an operation acts on: the main body, one header/footer variant of one section, or
|
|
12
|
+
* one note.
|
|
13
|
+
*
|
|
14
|
+
* A header is addressed by section INDEX plus variant rather than by relationship id, because
|
|
15
|
+
* that is how a caller thinks about it and because a section inheriting its predecessor's header
|
|
16
|
+
* has no relationship of its own to name.
|
|
17
|
+
*/
|
|
18
|
+
type AutomationStoryId = {
|
|
19
|
+
readonly kind: 'body';
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'header' | 'footer';
|
|
22
|
+
/** Position of the section in the document, from zero. */
|
|
23
|
+
readonly sectionIndex: number;
|
|
24
|
+
readonly variant: HeaderFooterVariant;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'note';
|
|
27
|
+
readonly noteKind: NoteKind;
|
|
28
|
+
readonly noteId: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** What a headless host can do. It paints nothing, so it claims nothing about painting. */
|
|
32
|
+
declare const SERVER_AUTOMATION_CAPABILITIES: AutomationCapabilities;
|
|
33
|
+
/**
|
|
34
|
+
* Why bytes could not be opened as a document: any bounded-reader rejection, plus the package
|
|
35
|
+
* that parsed but carried no main document part.
|
|
36
|
+
*/
|
|
37
|
+
type ServerAutomationHostRejection = OoxmlPackageRejection | 'no-main-document-part';
|
|
38
|
+
/**
|
|
39
|
+
* A host over the opened bytes, or a refusal.
|
|
40
|
+
*
|
|
41
|
+
* A result rather than a throw: these bytes are untrusted input, and a malformed upload should
|
|
42
|
+
* be a value the caller inspects rather than an exception from inside a zip decoder.
|
|
43
|
+
*/
|
|
44
|
+
type ServerAutomationHostResult = {
|
|
45
|
+
readonly ok: true;
|
|
46
|
+
readonly host: AutomationHost;
|
|
47
|
+
} | {
|
|
48
|
+
readonly ok: false;
|
|
49
|
+
readonly reason: ServerAutomationHostRejection;
|
|
50
|
+
readonly detail?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* How a headless host opens a document. Every field is optional.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
interface ServerAutomationHostOptions {
|
|
58
|
+
/**
|
|
59
|
+
* Tighter budgets for the bounded reader — zip ratio, part count, XML depth.
|
|
60
|
+
*
|
|
61
|
+
* Exposed because a server opening documents it did not author is exactly where a caller
|
|
62
|
+
* may want smaller limits than the defaults. Omitted means the engine's own defaults.
|
|
63
|
+
*/
|
|
64
|
+
readonly limits?: OoxmlPackageLimits;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Open DOCX bytes into a headless automation host.
|
|
68
|
+
*
|
|
69
|
+
* A typed rejection rather than a throw: every failure here is a property of the FILE, and a
|
|
70
|
+
* caller needs to tell "not a package" from "this package is hostile" from "no body".
|
|
71
|
+
*/
|
|
72
|
+
declare function createServerAutomationHost(bytes: Uint8Array, options?: ServerAutomationHostOptions): ServerAutomationHostResult;
|
|
73
|
+
|
|
74
|
+
export { AutomationCapabilities, AutomationHost, type AutomationStoryId, HEADER_FOOTER_VARIANTS, SERVER_AUTOMATION_CAPABILITIES, type ServerAutomationHostOptions, type ServerAutomationHostRejection, type ServerAutomationHostResult, createServerAutomationHost };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { A as AutomationCapabilities, a as AutomationHost } from './protocol-oxHaWmt4.js';
|
|
2
|
+
export { b as AUTOMATION_COMMAND_OPERATIONS, c as AUTOMATION_QUERY_OPERATIONS, d as AUTOMATION_SOLITARY_OPERATIONS, e as AutomationAlignment, f as AutomationBatchRequest, g as AutomationBatchResponse, h as AutomationChangeEvent, i as AutomationContentControlLock, j as AutomationContentControlRangeLocation, k as AutomationContentControlScope, l as AutomationContentControlSubtype, m as AutomationContentControlValue, n as AutomationError, o as AutomationErrorCode, p as AutomationFontRead, q as AutomationFontWrite, r as AutomationHandle, s as AutomationHandleRef, t as AutomationObjectKind, u as AutomationOperation, v as AutomationOperationKind, w as AutomationOperationResult, x as AutomationPageOrientation, y as AutomationPageSetupRead, z as AutomationPageSetupWrite, B as AutomationParagraphFormatRead, C as AutomationParagraphFormatWrite, D as AutomationParagraphRef, E as AutomationPoint, F as AutomationSaveResult, G as AutomationSearchOptions, H as AutomationSelectionMode, I as AutomationSpan, J as AutomationSpanRef, K as AutomationUnsubscribe, L as AutomationValue, M as isAutomationCommand, N as isSolitaryAutomationCommand } from './protocol-oxHaWmt4.js';
|
|
3
|
+
import { H as HeaderFooterVariant } from './hf-references-BdjsQNE_.js';
|
|
4
|
+
import { N as NoteKind } from './note-nodes-BPSTVDMr.js';
|
|
5
|
+
import { a as OoxmlPackageLimits, b as OoxmlPackageRejection } from './ooxml-package-D_CtywTW.js';
|
|
6
|
+
import './ooxml-tree-BU0e3DVi.js';
|
|
7
|
+
|
|
8
|
+
/** The variants a section can declare furniture for. */
|
|
9
|
+
declare const HEADER_FOOTER_VARIANTS: readonly HeaderFooterVariant[];
|
|
10
|
+
/**
|
|
11
|
+
* Which story an operation acts on: the main body, one header/footer variant of one section, or
|
|
12
|
+
* one note.
|
|
13
|
+
*
|
|
14
|
+
* A header is addressed by section INDEX plus variant rather than by relationship id, because
|
|
15
|
+
* that is how a caller thinks about it and because a section inheriting its predecessor's header
|
|
16
|
+
* has no relationship of its own to name.
|
|
17
|
+
*/
|
|
18
|
+
type AutomationStoryId = {
|
|
19
|
+
readonly kind: 'body';
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'header' | 'footer';
|
|
22
|
+
/** Position of the section in the document, from zero. */
|
|
23
|
+
readonly sectionIndex: number;
|
|
24
|
+
readonly variant: HeaderFooterVariant;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'note';
|
|
27
|
+
readonly noteKind: NoteKind;
|
|
28
|
+
readonly noteId: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** What a headless host can do. It paints nothing, so it claims nothing about painting. */
|
|
32
|
+
declare const SERVER_AUTOMATION_CAPABILITIES: AutomationCapabilities;
|
|
33
|
+
/**
|
|
34
|
+
* Why bytes could not be opened as a document: any bounded-reader rejection, plus the package
|
|
35
|
+
* that parsed but carried no main document part.
|
|
36
|
+
*/
|
|
37
|
+
type ServerAutomationHostRejection = OoxmlPackageRejection | 'no-main-document-part';
|
|
38
|
+
/**
|
|
39
|
+
* A host over the opened bytes, or a refusal.
|
|
40
|
+
*
|
|
41
|
+
* A result rather than a throw: these bytes are untrusted input, and a malformed upload should
|
|
42
|
+
* be a value the caller inspects rather than an exception from inside a zip decoder.
|
|
43
|
+
*/
|
|
44
|
+
type ServerAutomationHostResult = {
|
|
45
|
+
readonly ok: true;
|
|
46
|
+
readonly host: AutomationHost;
|
|
47
|
+
} | {
|
|
48
|
+
readonly ok: false;
|
|
49
|
+
readonly reason: ServerAutomationHostRejection;
|
|
50
|
+
readonly detail?: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* How a headless host opens a document. Every field is optional.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
interface ServerAutomationHostOptions {
|
|
58
|
+
/**
|
|
59
|
+
* Tighter budgets for the bounded reader — zip ratio, part count, XML depth.
|
|
60
|
+
*
|
|
61
|
+
* Exposed because a server opening documents it did not author is exactly where a caller
|
|
62
|
+
* may want smaller limits than the defaults. Omitted means the engine's own defaults.
|
|
63
|
+
*/
|
|
64
|
+
readonly limits?: OoxmlPackageLimits;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Open DOCX bytes into a headless automation host.
|
|
68
|
+
*
|
|
69
|
+
* A typed rejection rather than a throw: every failure here is a property of the FILE, and a
|
|
70
|
+
* caller needs to tell "not a package" from "this package is hostile" from "no body".
|
|
71
|
+
*/
|
|
72
|
+
declare function createServerAutomationHost(bytes: Uint8Array, options?: ServerAutomationHostOptions): ServerAutomationHostResult;
|
|
73
|
+
|
|
74
|
+
export { AutomationCapabilities, AutomationHost, type AutomationStoryId, HEADER_FOOTER_VARIANTS, SERVER_AUTOMATION_CAPABILITIES, type ServerAutomationHostOptions, type ServerAutomationHostRejection, type ServerAutomationHostResult, createServerAutomationHost };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {g}from'./chunk-PHDVKUWZ.js';export{c as AUTOMATION_COMMAND_OPERATIONS,b as AUTOMATION_QUERY_OPERATIONS,d as AUTOMATION_SOLITARY_OPERATIONS,a as HEADER_FOOTER_VARIANTS,f as isAutomationCommand,e as isSolitaryAutomationCommand}from'./chunk-PHDVKUWZ.js';import {wb,ef,Mc,xb,ff,gf,Oc}from'./chunk-RNBHTPW7.js';var y=Object.freeze({document:true,save:true,events:true,selection:false,scrolling:false,layout:false}),C=Object.freeze({kind:"body"});function I(e,r={}){let t=wb(e,r.limits??{});if(!t.ok)return {ok:false,reason:t.reason,...t.detail?{detail:t.detail}:{}};let o=t.package.parts.get(t.package.mainDocumentPart);if(!o)return {ok:false,reason:"no-main-document-part",detail:t.package.mainDocumentPart};let a=new ef(t.package,Mc(o));return {ok:true,host:g({port:h(a),capabilities:y})}}function T(e,r,t){let o=e.partFor(t);if(!o)return null;let a=Oc(e.currentPackage(),r,o.name);return a?(e.replacePackageShell(a.pkg),a.relationshipId):null}function h(e){let r=true;return {revision:()=>e.packageRevision,currentPackage:()=>r?e.currentPackage():null,apply(t,o=C){if(!r)return {ok:false,reason:"disposed"};let a=t(i=>T(e,i,o));if(a===null)return {ok:false,reason:"unsupported-target"};let n=e.transact(o,i=>{for(let f of a)i.apply(f);});return n.ok?{ok:true,changed:n.change!==null}:{ok:false,reason:n.detail?`${n.reason}: ${n.detail}`:n.reason}},applyLifecycle(t){if(!r)return {ok:false,reason:"disposed"};let o=e.applyLifecycleOp(t);return o.ok?{ok:true,changed:o.change!==null}:{ok:false,reason:o.detail?`${o.reason}: ${o.detail}`:o.reason}},applyCommentWrite(t,o){if(!r)return {ok:false,reason:"disposed"};let a=e.resolveStory(o);if(!a.ok)return {ok:false,reason:a.reason};a.store.graftPackage(()=>e.currentPackage());let n=t.kind==="reply"?ff(a.store,{anchor:t.anchor,author:t.author,text:t.text,...t.date===void 0?{}:{date:t.date},replyToCommentId:t.parentCommentId}):gf(a.store,t.commentId,t.resolved);return n.ok?(e.replacePackageShell(a.store.package),{ok:true,changed:true,..."commentId"in n?{commentId:n.commentId}:{}}):{ok:false,reason:n.reason}},save:()=>r?xb(e.currentPackage()):null,subscribe:t=>e.subscribe(()=>t()),dispose(){r=false;}}}export{y as SERVER_AUTOMATION_CAPABILITIES,I as createServerAutomationHost};
|
package/dist/binding.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkG7YCQBZE_cjs=require('./chunk-G7YCQBZE.cjs');require('./chunk-ZT55Q52J.cjs'),require('./chunk-MYH2HCUJ.cjs'),require('./chunk-ZMIX42J7.cjs');Object.defineProperty(exports,"PROJECTION_ORIGIN",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.k}});Object.defineProperty(exports,"bodyParagraphs",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.c}});Object.defineProperty(exports,"docToTreeOps",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.f}});Object.defineProperty(exports,"mountTreeSurface",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.l}});Object.defineProperty(exports,"openTreeSession",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.j}});Object.defineProperty(exports,"partHasNode",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.g}});Object.defineProperty(exports,"reconcileDoc",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.h}});Object.defineProperty(exports,"runPropsOf",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.b}});Object.defineProperty(exports,"treeSchema",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.a}});Object.defineProperty(exports,"treeToDoc",{enumerable:true,get:function(){return chunkG7YCQBZE_cjs.e}});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Node, Schema } from 'prosemirror-model';
|
|
2
|
+
import { O as OoxmlProperty } from './tree-op-types-DMiW6nIH.cjs';
|
|
3
|
+
import { T as TreeDocxSession } from './tree-session-D47_imvR.cjs';
|
|
4
|
+
export { D as DocumentStyleEntry, M as MapResult, O as OpenTreeSessionResult, P as PROJECTION_ORIGIN, a as TreeApplyResult, b as TreeBindingRejection, c as TreeSessionRejection, d as bodyParagraphs, e as docToTreeOps, o as openTreeSession, p as partHasNode, r as reconcileDoc, t as treeToDoc } from './tree-session-D47_imvR.cjs';
|
|
5
|
+
export { S as StoryScope, a as StoryTargetRejection } from './tree-package-store-DOKMtCnh.cjs';
|
|
6
|
+
import { EditorView } from 'prosemirror-view';
|
|
7
|
+
import './ooxml-tree-BU0e3DVi.cjs';
|
|
8
|
+
import './image-resources-BpIydXtU.cjs';
|
|
9
|
+
import './ooxml-package-CR5us6ad.cjs';
|
|
10
|
+
import './review-support-DS8DYX2a.cjs';
|
|
11
|
+
import './contracts/modules.cjs';
|
|
12
|
+
import './revision-projection-72ZApe-g.cjs';
|
|
13
|
+
import './hf-references-CgEOSw3i.cjs';
|
|
14
|
+
import './tree-store-CxifqwIv.cjs';
|
|
15
|
+
import './note-nodes-C6DLxlvj.cjs';
|
|
16
|
+
|
|
17
|
+
/** Attributes carried by a projected paragraph. */
|
|
18
|
+
interface ParagraphAttrs {
|
|
19
|
+
/** The canonical tree node id this paragraph projects. */
|
|
20
|
+
readonly nodeId: string | null;
|
|
21
|
+
/** Accepted `w:pPr` children, as authored. */
|
|
22
|
+
readonly props: readonly OoxmlProperty[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The ProseMirror schema the canonical tree projects into.
|
|
26
|
+
*
|
|
27
|
+
* Deliberately minimal. It models only what an editing surface must manipulate directly —
|
|
28
|
+
* paragraphs, text, tabs, breaks, and run properties as marks — because everything it does NOT
|
|
29
|
+
* model stays on the tree and is preserved losslessly there. Widening this schema moves content
|
|
30
|
+
* out of the tree's custody, which is the opposite of what it is for.
|
|
31
|
+
*/
|
|
32
|
+
declare const treeSchema: Schema<"paragraph" | "text" | "tab" | "hardBreak" | "pageBreak" | "doc" | "unknownInline", "runProps">;
|
|
33
|
+
/** The accepted run properties carried by a text node, or an empty list. */
|
|
34
|
+
declare function runPropsOf(node: Node): readonly OoxmlProperty[];
|
|
35
|
+
|
|
36
|
+
/** How a tree surface is mounted. */
|
|
37
|
+
interface TreeSurfaceOptions {
|
|
38
|
+
/** Called after every commit or refusal, so a host can show revision and rejection state. */
|
|
39
|
+
readonly onChange?: (state: TreeSurfaceState) => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Everything observable about a mounted tree surface.
|
|
43
|
+
*
|
|
44
|
+
* `lastRejection` is part of the state rather than a thrown error because a refused edit is an
|
|
45
|
+
* ordinary outcome here — the binding refuses anything it cannot explain, and the host shows why
|
|
46
|
+
* instead of the edit vanishing.
|
|
47
|
+
*/
|
|
48
|
+
interface TreeSurfaceState {
|
|
49
|
+
readonly revision: number;
|
|
50
|
+
readonly canUndo: boolean;
|
|
51
|
+
readonly canRedo: boolean;
|
|
52
|
+
/** The reason the last transaction was refused, or null when the last one committed. */
|
|
53
|
+
readonly lastRejection: string | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A mounted ProseMirror view bound to a {@link TreeDocxSession}.
|
|
57
|
+
*
|
|
58
|
+
* Every committed transaction becomes tree ops through the binding; a transaction the binding
|
|
59
|
+
* cannot explain is refused and reported through {@link TreeSurfaceState.lastRejection}, leaving
|
|
60
|
+
* the tree untouched.
|
|
61
|
+
*/
|
|
62
|
+
interface TreeSurface {
|
|
63
|
+
readonly view: EditorView;
|
|
64
|
+
state(): TreeSurfaceState;
|
|
65
|
+
undo(): void;
|
|
66
|
+
redo(): void;
|
|
67
|
+
/** Toggle one accepted run property across the current selection. */
|
|
68
|
+
toggleRunProperty(localName: string, attributes?: Record<string, string>): void;
|
|
69
|
+
destroy(): void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Mount an editable ProseMirror view over a session's body story.
|
|
73
|
+
*
|
|
74
|
+
* The reference binding, not the production surface — `mountPaginatedSurface` is what the shipped
|
|
75
|
+
* editor uses. This one exists to exercise the tree↔ProseMirror contract directly, without
|
|
76
|
+
* pagination or painting in the way.
|
|
77
|
+
*
|
|
78
|
+
* Call {@link TreeSurface.destroy} to release the view.
|
|
79
|
+
*/
|
|
80
|
+
declare function mountTreeSurface(mount: HTMLElement, session: TreeDocxSession, options?: TreeSurfaceOptions): TreeSurface;
|
|
81
|
+
|
|
82
|
+
export { type ParagraphAttrs, TreeDocxSession, type TreeSurface, type TreeSurfaceOptions, type TreeSurfaceState, mountTreeSurface, runPropsOf, treeSchema };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Node, Schema } from 'prosemirror-model';
|
|
2
|
+
import { O as OoxmlProperty } from './tree-op-types-CwOeiaQ8.js';
|
|
3
|
+
import { T as TreeDocxSession } from './tree-session-CiUel5Kz.js';
|
|
4
|
+
export { D as DocumentStyleEntry, M as MapResult, O as OpenTreeSessionResult, P as PROJECTION_ORIGIN, a as TreeApplyResult, b as TreeBindingRejection, c as TreeSessionRejection, d as bodyParagraphs, e as docToTreeOps, o as openTreeSession, p as partHasNode, r as reconcileDoc, t as treeToDoc } from './tree-session-CiUel5Kz.js';
|
|
5
|
+
export { S as StoryScope, a as StoryTargetRejection } from './tree-package-store-D5S7VKs5.js';
|
|
6
|
+
import { EditorView } from 'prosemirror-view';
|
|
7
|
+
import './ooxml-tree-BU0e3DVi.js';
|
|
8
|
+
import './image-resources-BJnTpG66.js';
|
|
9
|
+
import './ooxml-package-D_CtywTW.js';
|
|
10
|
+
import './review-support-Fy3vdIea.js';
|
|
11
|
+
import './contracts/modules.js';
|
|
12
|
+
import './revision-projection-DHAkcD_L.js';
|
|
13
|
+
import './hf-references-BdjsQNE_.js';
|
|
14
|
+
import './tree-store-hLtjeyWE.js';
|
|
15
|
+
import './note-nodes-BPSTVDMr.js';
|
|
16
|
+
|
|
17
|
+
/** Attributes carried by a projected paragraph. */
|
|
18
|
+
interface ParagraphAttrs {
|
|
19
|
+
/** The canonical tree node id this paragraph projects. */
|
|
20
|
+
readonly nodeId: string | null;
|
|
21
|
+
/** Accepted `w:pPr` children, as authored. */
|
|
22
|
+
readonly props: readonly OoxmlProperty[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The ProseMirror schema the canonical tree projects into.
|
|
26
|
+
*
|
|
27
|
+
* Deliberately minimal. It models only what an editing surface must manipulate directly —
|
|
28
|
+
* paragraphs, text, tabs, breaks, and run properties as marks — because everything it does NOT
|
|
29
|
+
* model stays on the tree and is preserved losslessly there. Widening this schema moves content
|
|
30
|
+
* out of the tree's custody, which is the opposite of what it is for.
|
|
31
|
+
*/
|
|
32
|
+
declare const treeSchema: Schema<"paragraph" | "text" | "tab" | "hardBreak" | "pageBreak" | "doc" | "unknownInline", "runProps">;
|
|
33
|
+
/** The accepted run properties carried by a text node, or an empty list. */
|
|
34
|
+
declare function runPropsOf(node: Node): readonly OoxmlProperty[];
|
|
35
|
+
|
|
36
|
+
/** How a tree surface is mounted. */
|
|
37
|
+
interface TreeSurfaceOptions {
|
|
38
|
+
/** Called after every commit or refusal, so a host can show revision and rejection state. */
|
|
39
|
+
readonly onChange?: (state: TreeSurfaceState) => void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Everything observable about a mounted tree surface.
|
|
43
|
+
*
|
|
44
|
+
* `lastRejection` is part of the state rather than a thrown error because a refused edit is an
|
|
45
|
+
* ordinary outcome here — the binding refuses anything it cannot explain, and the host shows why
|
|
46
|
+
* instead of the edit vanishing.
|
|
47
|
+
*/
|
|
48
|
+
interface TreeSurfaceState {
|
|
49
|
+
readonly revision: number;
|
|
50
|
+
readonly canUndo: boolean;
|
|
51
|
+
readonly canRedo: boolean;
|
|
52
|
+
/** The reason the last transaction was refused, or null when the last one committed. */
|
|
53
|
+
readonly lastRejection: string | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A mounted ProseMirror view bound to a {@link TreeDocxSession}.
|
|
57
|
+
*
|
|
58
|
+
* Every committed transaction becomes tree ops through the binding; a transaction the binding
|
|
59
|
+
* cannot explain is refused and reported through {@link TreeSurfaceState.lastRejection}, leaving
|
|
60
|
+
* the tree untouched.
|
|
61
|
+
*/
|
|
62
|
+
interface TreeSurface {
|
|
63
|
+
readonly view: EditorView;
|
|
64
|
+
state(): TreeSurfaceState;
|
|
65
|
+
undo(): void;
|
|
66
|
+
redo(): void;
|
|
67
|
+
/** Toggle one accepted run property across the current selection. */
|
|
68
|
+
toggleRunProperty(localName: string, attributes?: Record<string, string>): void;
|
|
69
|
+
destroy(): void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Mount an editable ProseMirror view over a session's body story.
|
|
73
|
+
*
|
|
74
|
+
* The reference binding, not the production surface — `mountPaginatedSurface` is what the shipped
|
|
75
|
+
* editor uses. This one exists to exercise the tree↔ProseMirror contract directly, without
|
|
76
|
+
* pagination or painting in the way.
|
|
77
|
+
*
|
|
78
|
+
* Call {@link TreeSurface.destroy} to release the view.
|
|
79
|
+
*/
|
|
80
|
+
declare function mountTreeSurface(mount: HTMLElement, session: TreeDocxSession, options?: TreeSurfaceOptions): TreeSurface;
|
|
81
|
+
|
|
82
|
+
export { type ParagraphAttrs, TreeDocxSession, type TreeSurface, type TreeSurfaceOptions, type TreeSurfaceState, mountTreeSurface, runPropsOf, treeSchema };
|