@docen/docx 0.3.3 → 0.3.5

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 (68) hide show
  1. package/dist/blockquote-DY80QC06.d.mts +21 -0
  2. package/dist/bullet-list-DF60pnSL.d.mts +12 -0
  3. package/dist/converters/docx.d.mts +1 -1
  4. package/dist/converters/docx.mjs +124 -25
  5. package/dist/converters/html.d.mts +1 -1
  6. package/dist/converters/html.mjs +1 -1
  7. package/dist/converters/markdown.d.mts +1 -1
  8. package/dist/converters/markdown.mjs +1 -1
  9. package/dist/converters/patch.d.mts +1 -1
  10. package/dist/converters/prepare.d.mts +1 -1
  11. package/dist/converters/prepare.mjs +6 -9
  12. package/dist/{core-B8ba_FNi.mjs → core-BnF8XhVE.mjs} +180 -31
  13. package/dist/core-DC0_-WcE.d.mts +387 -0
  14. package/dist/core.d.mts +1 -1
  15. package/dist/core.mjs +1 -1
  16. package/dist/details-Dd5MqqmR.d.mts +17 -0
  17. package/dist/editor.d.mts +1 -1
  18. package/dist/editor.mjs +1 -1
  19. package/dist/extensions/blockquote.d.mts +2 -22
  20. package/dist/extensions/bullet-list.d.mts +2 -0
  21. package/dist/extensions/bullet-list.mjs +21 -0
  22. package/dist/extensions/code-block.d.mts +1 -18
  23. package/dist/extensions/column-break.d.mts +1 -30
  24. package/dist/extensions/column-break.mjs +1 -1
  25. package/dist/extensions/details.d.mts +2 -18
  26. package/dist/extensions/document.mjs +2 -1
  27. package/dist/extensions/extensions.d.mts +10 -6
  28. package/dist/extensions/extensions.mjs +9 -4
  29. package/dist/extensions/formatting-marks.d.mts +1 -37
  30. package/dist/extensions/formatting-marks.mjs +1 -1
  31. package/dist/extensions/image.d.mts +1 -1
  32. package/dist/extensions/image.mjs +20 -4
  33. package/dist/extensions/index.d.mts +15 -2
  34. package/dist/extensions/index.mjs +17 -2
  35. package/dist/extensions/link.d.mts +2 -0
  36. package/dist/extensions/link.mjs +56 -0
  37. package/dist/extensions/mention.d.mts +2 -24
  38. package/dist/extensions/ordered-list.d.mts +1 -24
  39. package/dist/extensions/ordered-list.mjs +10 -1
  40. package/dist/extensions/page-break.d.mts +1 -1
  41. package/dist/extensions/page-break.mjs +1 -1
  42. package/dist/extensions/paragraph.mjs +13 -0
  43. package/dist/extensions/passthrough.d.mts +2 -2
  44. package/dist/extensions/passthrough.mjs +2 -2
  45. package/dist/extensions/scroll.d.mts +2 -0
  46. package/dist/extensions/scroll.mjs +33 -0
  47. package/dist/extensions/section-break.d.mts +1 -43
  48. package/dist/extensions/section-break.mjs +1 -1
  49. package/dist/extensions/tab.d.mts +2 -0
  50. package/dist/extensions/tab.mjs +2 -0
  51. package/dist/extensions/task-item.d.mts +2 -26
  52. package/dist/extensions/tiptap.d.mts +1 -1
  53. package/dist/extensions/toc-field.d.mts +1 -1
  54. package/dist/extensions/toc-field.mjs +1 -1
  55. package/dist/extensions/wpg-group.d.mts +2 -2
  56. package/dist/extensions/wpg-group.mjs +2 -2
  57. package/dist/extensions/wps-shape.d.mts +1 -1
  58. package/dist/extensions/wps-shape.mjs +1 -1
  59. package/dist/index.d.mts +31 -7
  60. package/dist/index.mjs +17 -2
  61. package/dist/link-BawPjQZR.d.mts +6 -0
  62. package/dist/mention-BGLzLVYw.d.mts +23 -0
  63. package/dist/ordered-list-DFAe-YEV.d.mts +25 -0
  64. package/dist/scroll-ZNeThJsJ.d.mts +18 -0
  65. package/dist/task-item-B0ntvQ1Y.d.mts +25 -0
  66. package/dist/{tiptap-pZsNPsvV.d.mts → tiptap-BKqn41uT.d.mts} +2 -2
  67. package/package.json +3 -3
  68. package/dist/core-DRaLI8nd.d.mts +0 -203
@@ -0,0 +1,387 @@
1
+ import { AnyExtension, Editor, Extension, Extensions, JSONContent as JSONContent$1, Mark, Node } from "@tiptap/core";
2
+
3
+ //#region src/extensions/code-block.d.ts
4
+ /**
5
+ * CodeBlock extension — CodeBlockLowlight with a DOCX renderDocx.
6
+ *
7
+ * DOCX has no dedicated code-block element. A code block maps to a single
8
+ * paragraph styled "Code" with a monospace run font. Inline marks (syntax-
9
+ * highlight tokens) and line breaks (`\n` → `<w:br/>`) are handled by
10
+ * DocxManager's shared inline-content compilation; resolveCodeBlock reassembles
11
+ * the text. This module owns only the paragraph-level style.
12
+ *
13
+ * `language` has no OOXML carrier and is intentionally dropped (known lossy).
14
+ */
15
+ /** codeBlock node → paragraph properties (style "Code" + monospace font). */
16
+ declare function renderDocx$1(_node: JSONContent$1): Record<string, unknown>;
17
+ declare const CodeBlock: import("@tiptap/core").Node<import("@tiptap/extension-code-block-lowlight").CodeBlockLowlightOptions, any>;
18
+ //#endregion
19
+ //#region src/extensions/column-break.d.ts
20
+ /**
21
+ * ColumnBreak — inline atom node for DOCX column breaks (`<w:br w:type="column"/>`).
22
+ *
23
+ * Sibling to PageBreak and HardBreak: all three render `<w:br>`, differing only
24
+ * by type. Inline (group "inline") to match the run-internal OOXML position,
25
+ * keeping a column break inside its paragraph on round-trip. Visual column
26
+ * layout (paged.js multi-column) is a future concern; the node preserves the
27
+ * break losslessly regardless.
28
+ *
29
+ * The DOCX payload (`{ columnBreak: true }`) is inlined in DocxManager — a
30
+ * one-liner with no per-node variance, so no extension helper for it.
31
+ *
32
+ * `setColumnBreak` only inserts the atom (no paragraph split): a column break
33
+ * does not start a new page, and there is no column layout to reflow yet, so
34
+ * the node is purely for round-trip fidelity until multi-column lands.
35
+ */
36
+ declare const ColumnBreak: Node<any, any>;
37
+ declare module "@tiptap/core" {
38
+ interface Commands<ReturnType> {
39
+ columnBreak: {
40
+ /** Insert a column break atom at the cursor (round-trip only until
41
+ * multi-column layout lands). */
42
+ setColumnBreak: () => ReturnType;
43
+ };
44
+ }
45
+ }
46
+ //#endregion
47
+ //#region src/extensions/section-break.d.ts
48
+ /**
49
+ * SectionBreak — command extension that marks a paragraph as a section boundary.
50
+ *
51
+ * OOXML sections (sectPr) attach to a section's LAST paragraph's pPr, NOT a
52
+ * standalone node. So this extension provides only the `setSectionBreak`
53
+ * command (stamps sectionProperties on the current paragraph); the paragraph
54
+ * extension carries the sectionProperties/sectionHeaders/sectionFooters attrs,
55
+ * and DocxManager splits/merges sections in compile/resolve by reading them off
56
+ * the paragraph.
57
+ *
58
+ * The final section's sectPr rides on doc.attrs.sectionProperties (it lives at
59
+ * <w:body>'s end in OOXML). Single-section documents have no section-carrying
60
+ * paragraph at all.
61
+ *
62
+ * Next Page semantics: `setSectionBreak` stamps sectionProperties on the current
63
+ * paragraph (making it the section's last paragraph) AND inserts a fresh empty
64
+ * paragraph after it (the next section's first paragraph), then moves the
65
+ * selection into that new paragraph. The page-plugin's `forcesPageBreakAfter`
66
+ * treats a sectionProperties-bearing paragraph as a page break, so repaginate
67
+ * pushes the new paragraph onto the next page — and the caret follows. This
68
+ * mirrors Word's "Section Break (Next Page)".
69
+ *
70
+ * Split hygiene: pressing Enter inside a section-carrying paragraph must NOT
71
+ * split it. A split would place the new paragraph past the section boundary —
72
+ * forcesPageBreakAfter then pushes it onto the next page (next section), and
73
+ * splitBlock would copy sectionProperties onto it (a second break mark). Word
74
+ * instead inserts a fresh paragraph BEFORE the section's last paragraph, so the
75
+ * new paragraph stays in this section and the stamped paragraph remains last.
76
+ * The Enter shortcut does exactly that; non-section paragraphs fall through to
77
+ * the default Enter unchanged.
78
+ */
79
+ declare const SectionBreak: Extension<any, any>;
80
+ declare module "@tiptap/core" {
81
+ interface Commands<ReturnType> {
82
+ sectionBreak: {
83
+ /** Insert a Next Page section break at the current paragraph. */setSectionBreak: () => ReturnType;
84
+ };
85
+ }
86
+ }
87
+ //#endregion
88
+ //#region src/extensions/image.d.ts
89
+ type CropRect = {
90
+ left?: number;
91
+ top?: number;
92
+ right?: number;
93
+ bottom?: number;
94
+ };
95
+ /**
96
+ * Tiptap JSON image node → CoreImageOptions-shaped object.
97
+ *
98
+ * Returns `{ image: ImageOptions }` (structural wrapper) or null when no
99
+ * embedded image data is available (external URLs need pre-fetching).
100
+ * rotation is carried via transformation.rotation (not dropped).
101
+ */
102
+ declare function renderDocx(node: JSONContent$1): Record<string, unknown> | null;
103
+ /**
104
+ * ImageOptions-shaped object → Tiptap attrs.
105
+ *
106
+ * Near-identity unpack: transformation → width/height/rotation, altText → alt/title,
107
+ * floating/srcRect(→crop)/outline passed through verbatim. src is reconstructed by
108
+ * DocxManager from the image data bytes (kept out of parseDocx).
109
+ */
110
+ declare function parseDocx(imageOpts: Record<string, unknown>): Record<string, unknown>;
111
+ /** Extent-box dimensions needed to size the inner <img> for a cropped image. */
112
+ interface CropRenderContext {
113
+ width?: number;
114
+ height?: number;
115
+ }
116
+ /**
117
+ * Render crop as the inner <img> style for byte-accurate four-sided srcRect.
118
+ *
119
+ * object-fit:cover scales uniformly, so it only matches single-axis crops.
120
+ * Instead the inner <img> is sized to the un-cropped display size per axis
121
+ * (imgW = W/visibleW, imgH = H/visibleH) and translated so the visible srcRect
122
+ * region maps exactly onto the extent box; the outer box clips (overflow:hidden)
123
+ * the cropped-out left/top region. Mathematically equivalent to a
124
+ * background-size/background-position crop, but keeps a real <img> (alt,
125
+ * accessibility, semantics, drag-to-save).
126
+ */
127
+ declare function renderCropAttrs(crop: Record<string, unknown> | CropRect, ctx?: CropRenderContext): {
128
+ style: string;
129
+ };
130
+ declare const Image: import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any>;
131
+ //#endregion
132
+ //#region src/extensions/formatting-marks.d.ts
133
+ /**
134
+ * FormattingMarks — paints the non-printing paragraph mark via ProseMirror
135
+ * widget decorations.
136
+ *
137
+ * CSS `p::after { content: "…" }` does NOT work on a ProseMirror-managed
138
+ * paragraph: the view owns the DOM and the trailing-break kludge pushes the
139
+ * pseudo-element off the visible line, so the mark never appears (verified).
140
+ * Marijn Haverbeke endorses widget decorations for exactly this use case
141
+ * (https://discuss.prosemirror.net/t/1442). Each textblock gets a widget at its
142
+ * closing position (inside the textblock, so it stays on the content's line)
143
+ * holding a non-editable `<span class="docen-para-mark">`. `side: 1` keeps the
144
+ * mark to the right of a cursor resting at the paragraph end (the cursor always
145
+ * precedes its own paragraph mark).
146
+ *
147
+ * Glyph: a down-then-left return arrow (↲, U+21B2 "downwards arrow with tip
148
+ * leftwards" — the Enter-key glyph). Word/WPS use the pilcrow ¶ for paragraph
149
+ * marks; that down-then-left arrow is Word's line-break glyph — adopted here as
150
+ * the paragraph mark per the project's visual preference.
151
+ *
152
+ * Performance: the widget set is cached in plugin state and rebuilt only on a
153
+ * doc change or a marks toggle — NOT on every selectionUpdate. Without the
154
+ * cache, each caret move / selection re-traverses the whole document (one
155
+ * widget per textblock) and rebuilds the set, which costs 200ms+ on 1000-page
156
+ * documents. Pure selection transactions now reuse the cached set in O(1).
157
+ */
158
+ declare const FormattingMarks: Extension<any, any>;
159
+ declare module "@tiptap/core" {
160
+ interface Commands<ReturnType> {
161
+ formattingMarks: {
162
+ /** Toggle the non-printing paragraph marks on or off. */toggleFormattingMarks: () => ReturnType;
163
+ };
164
+ }
165
+ }
166
+ //#endregion
167
+ //#region src/extensions/page-break.d.ts
168
+ /**
169
+ * PageBreak — inline atom node for DOCX page breaks (`<w:br w:type="page"/>`).
170
+ *
171
+ * OOXML page breaks live inside a run (inline), so the Tiptap node is inline
172
+ * too (group "inline"). This keeps a break inside its paragraph on round-trip
173
+ * — a break mid-paragraph stays mid-paragraph instead of splitting the
174
+ * paragraph into separate blocks (which would lose the original structure).
175
+ * Sibling to HardBreak: both render `<w:br>`, differing only by type.
176
+ *
177
+ * The DOCX payload (`{ pageBreak: true }`) is inlined in DocxManager — a
178
+ * one-liner with no per-node variance, so no extension helper for it.
179
+ *
180
+ * Inserting a page break must also visually reflow (the C-route paginator only
181
+ * forces a new page after a block *containing* a pageBreak atom). So
182
+ * `setPageBreak` inserts the atom then splits the paragraph — the atom lands at
183
+ * the end of the first half, the trailing text becomes a fresh paragraph, and
184
+ * the paginator's `forcesPageBreakAfter` moves it to the next page (matching
185
+ * Word's Ctrl+Enter behavior).
186
+ */
187
+ declare const PageBreak: Node<any, any>;
188
+ declare module "@tiptap/core" {
189
+ interface Commands<ReturnType> {
190
+ pageBreak: {
191
+ /** Insert a page break at the cursor and split the paragraph so the
192
+ * trailing content reflows to the next page. */
193
+ setPageBreak: () => ReturnType;
194
+ };
195
+ }
196
+ }
197
+ //#endregion
198
+ //#region src/extensions/wpg-group.d.ts
199
+ interface FillColor {
200
+ value?: string;
201
+ }
202
+ interface Fill {
203
+ type?: string;
204
+ color?: FillColor;
205
+ }
206
+ interface Outline {
207
+ type?: string;
208
+ color?: FillColor;
209
+ width?: number;
210
+ dash?: string;
211
+ }
212
+ /** wps shape data (WpsShapeCoreOptions subset used for rendering). */
213
+ interface WpsBodyProperties {
214
+ rotation?: number;
215
+ lIns?: number;
216
+ tIns?: number;
217
+ rIns?: number;
218
+ bIns?: number;
219
+ vert?: string;
220
+ anchor?: string;
221
+ }
222
+ interface WpsData {
223
+ fill?: Fill;
224
+ outline?: Outline;
225
+ bodyProperties?: WpsBodyProperties & Record<string, unknown>;
226
+ children?: unknown[];
227
+ }
228
+ type Spec = ReadonlyArray<unknown>;
229
+ /** wps text-body paragraphs (office-open ParagraphOptions[]) → inline HTML runs
230
+ * so a text-box shape shows its text. Each paragraph's run defaults merge with
231
+ * each text run; renderRunStyles converts font/color/size/… to CSS. Advanced run
232
+ * props (shadow w14RawXml, kern) are carried in attrs but not rendered. */
233
+ declare function renderWpsText(children: unknown): Spec[];
234
+ /** Inner style of a wps text-box: fill + outline + textbox insets (padding).
235
+ * Lives on the contentDOM (the editable interior). Never carries rotation or
236
+ * writing-mode — those go on the outer positioning wrapper (see
237
+ * wpsRotationVert), because transform/writing-mode on an editable region
238
+ * distort the caret rect and break CJK IME composition. */
239
+ declare function wpsInnerStyle(data: WpsData): string;
240
+ /** Rotation + writing-mode (text direction) for a wps shape. Lives on the
241
+ * positioning wrapper OUTSIDE the contentDOM. `rotationOverride` covers a
242
+ * group child whose rotation comes from the group transform, not bodyPr. */
243
+ declare function wpsRotationVert(data: WpsData, rotationOverride?: number): string;
244
+ /**
245
+ * Render a wps shape's interior (fill/outline/insets/rotation/writing-mode + text
246
+ * body) as a positioned div. Shared by the wpg group's inline wps children and
247
+ * the standalone wpsShape node, so a text-box shape renders identically whether
248
+ * it floats alone (wp:anchor > wps:wsp) or sits inside a group. `positionStyle`
249
+ * carries the placement — absolute group coords for a group child, the floating
250
+ * anchor CSS for a standalone shape. `opts.rotation` overrides bodyPr rotation
251
+ * (a group child's rotation may come from the group transform, not bodyPr).
252
+ *
253
+ * The wpg path merges placement + interior into ONE div (an atom has no
254
+ * contentDOM, so rotation/writing-mode on the element is safe — no caret inside).
255
+ * The editable wpsShape node instead splits these across two elements via
256
+ * wpsShapeStyles (outer = position+rotation+vert, inner = contentDOM).
257
+ */
258
+ declare function renderWpsInterior(data: WpsData, positionStyle: string, opts?: {
259
+ rotation?: number;
260
+ attrs?: Record<string, string>;
261
+ }): Spec;
262
+ /** Shape data subset carrying its own extent + floating anchor (a standalone
263
+ * wpsShape, not a wpg group child). */
264
+ interface WpsShapeStandalone extends WpsData {
265
+ transformation?: {
266
+ width?: number;
267
+ height?: number;
268
+ };
269
+ floating?: unknown;
270
+ }
271
+ interface WpsShapeStyles {
272
+ /** outer wrapper (dom): floating/inline placement + size + rotation + writing-mode. */
273
+ outer: string;
274
+ /** inner contentDOM: box-sizing + fill + outline + textbox insets (padding). */
275
+ inner: string;
276
+ /** true when the floating anchor resolves against the anchor paragraph
277
+ * (vRelative "paragraph") — the editor marks the anchor <p> relative. */
278
+ paragraphAnchor: boolean;
279
+ }
280
+ /** Two-element style split for an editable standalone wpsShape: `outer` for the
281
+ * positioning wrapper (dom), `inner` for the contentDOM. rotation/writing-mode
282
+ * stay on `outer` so the editable interior has a clean caret/IME rect. The
283
+ * geometry (EMU extent → px, floating anchor CSS) is computed here so the
284
+ * editor's NodeView and generateHTML render identically without re-deriving
285
+ * the engine's EMU/floating math. */
286
+ declare function wpsShapeStyles(ws: WpsShapeStandalone): WpsShapeStyles;
287
+ declare const WpgGroup: Node<any, any>;
288
+ //#endregion
289
+ //#region src/extensions/wps-shape.d.ts
290
+ declare const WpsShape: Node<any, any>;
291
+ //#endregion
292
+ //#region src/extensions/passthrough.d.ts
293
+ /**
294
+ * Passthrough — block atom carrying an opaque {@link SectionChild} that has
295
+ * no native Tiptap representation (rawXml, bookmarkStart/End, textbox,
296
+ * altChunk, subDoc, customXml).
297
+ *
298
+ * The full SectionChild is stored as JSON in `attrs.data` so the DOCX→JSON→DOCX
299
+ * round-trip stays byte-faithful: office-open's stringify handles the inner
300
+ * structure verbatim (including a textbox's nested children, which remain as
301
+ * structured ParagraphOptions inside the blob rather than editable Tiptap
302
+ * nodes). The node is not editable — it renders a read-only placeholder in HTML.
303
+ *
304
+ * DOCX serialization is inlined in DocxManager (compile/resolve read/write
305
+ * `attrs.data` directly), so no renderDocx/parseDocx is needed here.
306
+ */
307
+ declare const Passthrough: Node<any, any>;
308
+ /**
309
+ * InlinePassthrough — inline atom carrying an opaque inline ParagraphChild that
310
+ * has no native Tiptap representation (bookmarkStart/End, comment range markers,
311
+ * proofErr, track-change markers, …). The full ParagraphChild rides in
312
+ * `attrs.data` as JSON so DOCX→JSON→DOCX round-trips byte-faithful; the atom is
313
+ * zero-width (bookmark/range markers carry no layout box), matching Word's
314
+ * non-printing metadata. Mirrors the block-level Passthrough for inline children.
315
+ */
316
+ declare const InlinePassthrough: Node<any, any>;
317
+ //#endregion
318
+ //#region src/extensions/toc-field.d.ts
319
+ /**
320
+ * TOC field (`tocField`) — a block container representing a DOCX table of
321
+ * contents, with the rendered entries as editable `content` and the TOC field
322
+ * switches on `attrs.options`.
323
+ *
324
+ * Named `tocField` (not `tableOfContents`) to avoid colliding with the official
325
+ * `@tiptap/extension-table-of-contents`, which is an `Extension` (a live outline
326
+ * generator injected into the editor) that already owns the `tableOfContents`
327
+ * name. Same-name extensions dedupe in Tiptap, and since the official one is not
328
+ * a node it would erase this node type from the schema. The two coexist for
329
+ * different purposes: this node persists a DOCX's rendered TOC; the official
330
+ * extension drives the heading-outline pane.
331
+ *
332
+ * Structuring the TOC as a node (instead of opaque passthrough) is what fixes
333
+ * the export crash. Each entry paragraph's `w:hyperlink` wraps a HYPERLINK field
334
+ * whose content-less runs (fldChar begin/separate/end) office-open parses as
335
+ * `null`. As opaque passthrough those nulls survived verbatim to
336
+ * `generateDocument`, where office-open's `stringifyRunInline(null).break`
337
+ * crashed. Resolving the entries through `resolveParagraphChildren` drops the
338
+ * nulls (the existing `child !== null` guard), so compile rebuilds clean entries
339
+ * and the generate path never sees a null — no office-open change required.
340
+ *
341
+ * DOCX serialization is inlined in DocxManager (resolve/compile read/write
342
+ * `attrs.options` + the entry content directly), so no renderDocx/parseDocx is
343
+ * needed here — the same pattern as the details extension.
344
+ */
345
+ declare const TocField: Node<any, any>;
346
+ //#endregion
347
+ //#region src/extensions/tab.d.ts
348
+ /**
349
+ * Tab — an inline atom representing a DOCX `<w:r><w:tab/></w:r>` tab character.
350
+ *
351
+ * office-open parses `<w:tab/>` as `{ tab: true }` inside a run's children. The
352
+ * resolve path turns that into this node so the tab is not lost: previously
353
+ * `<w:tab/>` was dropped, which let `mergeTextNodes` collapse a TOC entry's title
354
+ * and page number into adjacent text (no leader, no right alignment). The node is
355
+ * zero-width, non-editable, and carries no text height — measure skips it the
356
+ * same way it skips other inline atoms, so pagination is unaffected. It only
357
+ * marks where a tab leader (e.g. a TOC's dotted leader) renders. compile turns it
358
+ * back into `{ tab: true }`.
359
+ */
360
+ declare const Tab: Node<any, any>;
361
+ //#endregion
362
+ //#region src/extensions/extensions.d.ts
363
+ declare const tiptapNodeExtensions: AnyExtension[];
364
+ declare const tiptapMarkExtensions: AnyExtension[];
365
+ declare const docxExtensions: AnyExtension[];
366
+ interface DocxKitOptions {
367
+ bold?: Record<string, any> | false;
368
+ blockquote?: Record<string, any> | false;
369
+ bulletList?: Record<string, any> | false;
370
+ code?: Record<string, any> | false;
371
+ codeBlock?: Record<string, any> | false;
372
+ document?: false;
373
+ hardBreak?: Record<string, any> | false;
374
+ heading?: Record<string, any> | false;
375
+ horizontalRule?: Record<string, any> | false;
376
+ italic?: Record<string, any> | false;
377
+ listItem?: Record<string, any> | false;
378
+ link?: Record<string, any> | false;
379
+ orderedList?: Record<string, any> | false;
380
+ paragraph?: Record<string, any> | false;
381
+ strike?: Record<string, any> | false;
382
+ text?: false;
383
+ underline?: Record<string, any> | false;
384
+ }
385
+ declare const DocxKit: Extension<DocxKitOptions, any>;
386
+ //#endregion
387
+ export { Image as A, renderWpsText as C, PageBreak as D, wpsShapeStyles as E, ColumnBreak as F, CodeBlock as I, renderDocx$1 as L, renderCropAttrs as M, renderDocx as N, FormattingMarks as O, SectionBreak as P, renderWpsInterior as S, wpsRotationVert as T, WpsShape as _, JSONContent$1 as a, WpsShapeStandalone as b, DocxKit as c, tiptapMarkExtensions as d, tiptapNodeExtensions as f, Passthrough as g, InlinePassthrough as h, Extensions as i, parseDocx as j, CropRenderContext as k, DocxKitOptions as l, TocField as m, Editor as n, Mark as o, Tab as p, Extension as r, Node as s, AnyExtension as t, docxExtensions as u, WpgGroup as v, wpsInnerStyle as w, WpsShapeStyles as x, WpsData as y };
package/dist/core.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as JSONContent, f as docxExtensions, i as Extensions, n as Editor, o as Mark, r as Extension, s as Node, t as AnyExtension } from "./core-DRaLI8nd.mjs";
1
+ import { a as JSONContent, i as Extensions, n as Editor, o as Mark, r as Extension, s as Node, t as AnyExtension, u as docxExtensions } from "./core-DC0_-WcE.mjs";
2
2
  export { type AnyExtension, Editor, Extension, type Extensions, type JSONContent, Mark, Node, docxExtensions };
package/dist/core.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { i as Node, n as Extension, r as Mark, s as docxExtensions, t as Editor } from "./core-B8ba_FNi.mjs";
1
+ import { i as Node, n as Extension, o as docxExtensions, r as Mark, t as Editor } from "./core-BnF8XhVE.mjs";
2
2
  export { Editor, Extension, Mark, Node, docxExtensions };
@@ -0,0 +1,17 @@
1
+ //#region src/extensions/details.d.ts
2
+ /**
3
+ * Details extension — owns the DOCX expression of a collapsible details block.
4
+ *
5
+ * DOCX has no native collapsible region, but a block-level group-SDT is a
6
+ * reversible container. The details maps to one group-SDT tagged "docen-
7
+ * details"; the summary paragraph is marked with a fixed style so resolve can
8
+ * split it back out from the content paragraphs. Structure round-trips fully
9
+ * (summary + content); Word shows it expanded (no collapse) — an inherent
10
+ * DOCX limitation, not data loss.
11
+ */
12
+ /** SDT tag marking a details group content control. */
13
+ declare const DETAILS_TAG = "docen-details";
14
+ /** Paragraph style marking the summary line within a details group-SDT. */
15
+ declare const DETAILS_SUMMARY_STYLE = "DocenDetailsSummary";
16
+ //#endregion
17
+ export { DETAILS_TAG as n, DETAILS_SUMMARY_STYLE as t };
package/dist/editor.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Editor, t as AnyExtension } from "./core-DRaLI8nd.mjs";
1
+ import { n as Editor, t as AnyExtension } from "./core-DC0_-WcE.mjs";
2
2
 
3
3
  //#region src/editor.d.ts
4
4
  interface DocxEditorOptions {
package/dist/editor.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { s as docxExtensions, t as Editor } from "./core-B8ba_FNi.mjs";
1
+ import { o as docxExtensions, t as Editor } from "./core-BnF8XhVE.mjs";
2
2
  //#region src/editor.ts
3
3
  /**
4
4
  * Create a Tiptap editor configured for DOCX editing.
@@ -1,23 +1,3 @@
1
- import { t as Blockquote } from "../tiptap-pZsNPsvV.mjs";
2
-
3
- //#region src/extensions/blockquote.d.ts
4
- /**
5
- * Blockquote extension — owns the DOCX expression of a blockquote.
6
- *
7
- * DOCX has no blockquote element; the convention is a left indent plus a left
8
- * border on each contained paragraph. This module owns that signature; the
9
- * DocxManager walks the blockquote's child paragraphs and applies it to each.
10
- */
11
- /** Left indent (twips, ~0.5 inch) marking a blockquote. */
12
- declare const BLOCKQUOTE_INDENT_LEFT = 720;
13
- /** Left border marking a blockquote. */
14
- declare const BLOCKQUOTE_BORDER: {
15
- readonly style: "single";
16
- readonly size: 18;
17
- readonly space: 12;
18
- readonly color: "CCCCCC";
19
- };
20
- /** Apply the blockquote signature (left indent + left border) to paragraph opts. */
21
- declare function applyBlockquoteStyle(paraObj: Record<string, unknown>): void;
22
- //#endregion
1
+ import { t as Blockquote } from "../tiptap-BKqn41uT.mjs";
2
+ import { n as BLOCKQUOTE_INDENT_LEFT, r as applyBlockquoteStyle, t as BLOCKQUOTE_BORDER } from "../blockquote-DY80QC06.mjs";
23
3
  export { BLOCKQUOTE_BORDER, BLOCKQUOTE_INDENT_LEFT, Blockquote, applyBlockquoteStyle };
@@ -0,0 +1,2 @@
1
+ import { t as BulletList } from "../bullet-list-DF60pnSL.mjs";
2
+ export { BulletList };
@@ -0,0 +1,21 @@
1
+ import { BulletList as BulletList$1 } from "./tiptap.mjs";
2
+ //#region src/extensions/bullet-list.ts
3
+ /**
4
+ * BulletList — carries the source DOCX abstractNum reference (when the list came
5
+ * from parseDOCX) so the round-trip reuses the original numbering definition
6
+ * (custom bullet glyph/font/indent, e.g. a Wingdings marker) instead of
7
+ * regenerating the default. The `numbering` attr is DOCX-only (not rendered
8
+ * to HTML); lists created in the editor carry null and compile to the default
9
+ * bullet.
10
+ */
11
+ const BulletList = BulletList$1.extend({ addAttributes() {
12
+ return {
13
+ ...this.parent?.(),
14
+ numbering: {
15
+ default: null,
16
+ rendered: false
17
+ }
18
+ };
19
+ } });
20
+ //#endregion
21
+ export { BulletList };
@@ -1,19 +1,2 @@
1
- import { a as JSONContent } from "../core-DRaLI8nd.mjs";
2
-
3
- //#region src/extensions/code-block.d.ts
4
- /**
5
- * CodeBlock extension — CodeBlockLowlight with a DOCX renderDocx.
6
- *
7
- * DOCX has no dedicated code-block element. A code block maps to a single
8
- * paragraph styled "Code" with a monospace run font. Inline marks (syntax-
9
- * highlight tokens) and line breaks (`\n` → `<w:br/>`) are handled by
10
- * DocxManager's shared inline-content compilation; resolveCodeBlock reassembles
11
- * the text. This module owns only the paragraph-level style.
12
- *
13
- * `language` has no OOXML carrier and is intentionally dropped (known lossy).
14
- */
15
- /** codeBlock node → paragraph properties (style "Code" + monospace font). */
16
- declare function renderDocx(_node: JSONContent): Record<string, unknown>;
17
- declare const CodeBlock: import("@tiptap/core").Node<import("@tiptap/extension-code-block-lowlight").CodeBlockLowlightOptions, any>;
18
- //#endregion
1
+ import { I as CodeBlock, L as renderDocx } from "../core-DC0_-WcE.mjs";
19
2
  export { CodeBlock, renderDocx };
@@ -1,31 +1,2 @@
1
- import { s as Node } from "../core-DRaLI8nd.mjs";
2
-
3
- //#region src/extensions/column-break.d.ts
4
- /**
5
- * ColumnBreak — inline atom node for DOCX column breaks (`<w:br w:type="column"/>`).
6
- *
7
- * Sibling to PageBreak and HardBreak: all three render `<w:br>`, differing only
8
- * by type. Inline (group "inline") to match the run-internal OOXML position,
9
- * keeping a column break inside its paragraph on round-trip. Visual column
10
- * layout (paged.js multi-column) is a future concern; the node preserves the
11
- * break losslessly regardless.
12
- *
13
- * The DOCX payload (`{ columnBreak: true }`) is inlined in DocxManager — a
14
- * one-liner with no per-node variance, so no extension helper for it.
15
- *
16
- * `setColumnBreak` only inserts the atom (no paragraph split): a column break
17
- * does not start a new page, and there is no column layout to reflow yet, so
18
- * the node is purely for round-trip fidelity until multi-column lands.
19
- */
20
- declare const ColumnBreak: Node<any, any>;
21
- declare module "@tiptap/core" {
22
- interface Commands<ReturnType> {
23
- columnBreak: {
24
- /** Insert a column break atom at the cursor (round-trip only until
25
- * multi-column layout lands). */
26
- setColumnBreak: () => ReturnType;
27
- };
28
- }
29
- }
30
- //#endregion
1
+ import { F as ColumnBreak } from "../core-DC0_-WcE.mjs";
31
2
  export { ColumnBreak };
@@ -1,2 +1,2 @@
1
- import { y as ColumnBreak } from "../core-B8ba_FNi.mjs";
1
+ import { C as ColumnBreak } from "../core-BnF8XhVE.mjs";
2
2
  export { ColumnBreak };
@@ -1,19 +1,3 @@
1
- import { c as DetailsSummary, o as Details, s as DetailsContent } from "../tiptap-pZsNPsvV.mjs";
2
-
3
- //#region src/extensions/details.d.ts
4
- /**
5
- * Details extension — owns the DOCX expression of a collapsible details block.
6
- *
7
- * DOCX has no native collapsible region, but a block-level group-SDT is a
8
- * reversible container. The details maps to one group-SDT tagged "docen-
9
- * details"; the summary paragraph is marked with a fixed style so resolve can
10
- * split it back out from the content paragraphs. Structure round-trips fully
11
- * (summary + content); Word shows it expanded (no collapse) — an inherent
12
- * DOCX limitation, not data loss.
13
- */
14
- /** SDT tag marking a details group content control. */
15
- declare const DETAILS_TAG = "docen-details";
16
- /** Paragraph style marking the summary line within a details group-SDT. */
17
- declare const DETAILS_SUMMARY_STYLE = "DocenDetailsSummary";
18
- //#endregion
1
+ import { c as DetailsSummary, o as Details, s as DetailsContent } from "../tiptap-BKqn41uT.mjs";
2
+ import { n as DETAILS_TAG, t as DETAILS_SUMMARY_STYLE } from "../details-Dd5MqqmR.mjs";
19
3
  export { DETAILS_SUMMARY_STYLE, DETAILS_TAG, Details, DetailsContent, DetailsSummary };
@@ -35,7 +35,8 @@ function createDocument(content = "block+") {
35
35
  sectionHeaders: attrNative(),
36
36
  sectionFooters: attrNative(),
37
37
  background: attrNative(),
38
- documentExtras: attrNative()
38
+ documentExtras: attrNative(),
39
+ numbering: attrNative()
39
40
  };
40
41
  }
41
42
  });
@@ -1,12 +1,16 @@
1
- import { A as TaskItem, F as Underline, M as Text, T as Superscript, _ as Link, a as CodeBlockLowlight, b as Mention, c as DetailsSummary, d as HardBreak, g as Italic, i as Code, j as TaskList, m as HorizontalRule, n as Bold, o as Details, p as Highlight, r as BulletList, s as DetailsContent, t as Blockquote, u as Emoji, v as ListItem, w as Subscript, x as OrderedList, y as Mathematics } from "../tiptap-pZsNPsvV.mjs";
2
- import { t as Document } from "../document-Cws7XTYL.mjs";
3
- import { t as Heading } from "../heading-BvqBD2zX.mjs";
4
- import { C as Image, _ as WpsShape, d as TextAlign, f as docxExtensions, g as Passthrough, h as TocField, l as DocxKit, m as tiptapNodeExtensions, p as tiptapMarkExtensions, u as DocxKitOptions, v as WpgGroup } from "../core-DRaLI8nd.mjs";
1
+ import { A as TaskItem, F as Underline, M as Text, N as TextAlign, T as Superscript, a as CodeBlockLowlight, b as Mention, c as DetailsSummary, d as HardBreak, g as Italic, i as Code, j as TaskList, m as HorizontalRule, n as Bold, o as Details, p as Highlight, s as DetailsContent, t as Blockquote, u as Emoji, v as ListItem, w as Subscript, y as Mathematics } from "../tiptap-BKqn41uT.mjs";
2
+ import { n as createDocument, t as Document } from "../document-Cws7XTYL.mjs";
5
3
  import { t as Paragraph } from "../paragraph-D8mpHo_o.mjs";
6
- import { t as TableRow } from "../table-row-kgzYkZlW.mjs";
4
+ import { t as Heading } from "../heading-BvqBD2zX.mjs";
5
+ import { t as BulletList } from "../bullet-list-DF60pnSL.mjs";
6
+ import { r as OrderedList } from "../ordered-list-DFAe-YEV.mjs";
7
+ import { A as Image, D as PageBreak, E as wpsShapeStyles, F as ColumnBreak, I as CodeBlock, O as FormattingMarks, P as SectionBreak, _ as WpsShape, b as WpsShapeStandalone, c as DocxKit, d as tiptapMarkExtensions, f as tiptapNodeExtensions, g as Passthrough, h as InlinePassthrough, l as DocxKitOptions, m as TocField, p as Tab, u as docxExtensions, v as WpgGroup, x as WpsShapeStyles } from "../core-DC0_-WcE.mjs";
7
8
  import { t as Table } from "../table-BFkfeRp9.mjs";
9
+ import { t as TableRow } from "../table-row-kgzYkZlW.mjs";
8
10
  import { t as TableCell } from "../table-cell-D_FV4D2h.mjs";
9
11
  import { t as TableHeader } from "../table-header-KGQ2aEkP.mjs";
12
+ import { t as Link } from "../link-BawPjQZR.mjs";
10
13
  import { t as Strike } from "../strike-BgWGvjKr.mjs";
11
14
  import { t as TextStyle } from "../text-style-BHdtXkMb.mjs";
12
- export { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Document, DocxKit, DocxKitOptions, Emoji, HardBreak, Heading, Highlight, HorizontalRule, Image, Italic, Link, ListItem, Mathematics, Mention, OrderedList, Paragraph, Passthrough, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TocField, Underline, WpgGroup, WpsShape, docxExtensions, tiptapMarkExtensions, tiptapNodeExtensions };
15
+ import { n as scrollContainerOf, t as scrollCaretToTop } from "../scroll-ZNeThJsJ.mjs";
16
+ export { Blockquote, Bold, BulletList, Code, CodeBlock, CodeBlockLowlight, ColumnBreak, Details, DetailsContent, DetailsSummary, Document, DocxKit, DocxKitOptions, Emoji, FormattingMarks, HardBreak, Heading, Highlight, HorizontalRule, Image, InlinePassthrough, Italic, Link, ListItem, Mathematics, Mention, OrderedList, PageBreak, Paragraph, Passthrough, SectionBreak, Strike, Subscript, Superscript, Tab, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TocField, Underline, WpgGroup, WpsShape, type WpsShapeStandalone, type WpsShapeStyles, createDocument, docxExtensions, scrollCaretToTop, scrollContainerOf, tiptapMarkExtensions, tiptapNodeExtensions, wpsShapeStyles };
@@ -1,8 +1,13 @@
1
- import { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Emoji, HardBreak, Highlight, HorizontalRule, Italic, Link, ListItem, Mathematics, Mention, OrderedList, Subscript, Superscript, TaskItem, TaskList, Text, Underline } from "./tiptap.mjs";
2
- import { a as DocxKit, c as tiptapMarkExtensions, d as WpgGroup, g as Passthrough, l as tiptapNodeExtensions, m as TocField, o as TextAlign, s as docxExtensions, u as WpsShape } from "../core-B8ba_FNi.mjs";
3
- import { Document } from "./document.mjs";
1
+ import { Blockquote, Bold, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Emoji, HardBreak, Highlight, HorizontalRule, Italic, ListItem, Mathematics, Mention, Subscript, Superscript, TaskItem, TaskList, Text, TextAlign, Underline } from "./tiptap.mjs";
2
+ import { BulletList } from "./bullet-list.mjs";
3
+ import { CodeBlock } from "./code-block.mjs";
4
+ import { C as ColumnBreak, S as FormattingMarks, _ as Tab, a as DocxKit, b as Passthrough, c as tiptapNodeExtensions, g as TocField, h as wpsShapeStyles, l as WpsShape, o as docxExtensions, s as tiptapMarkExtensions, u as WpgGroup, v as SectionBreak, x as PageBreak, y as InlinePassthrough } from "../core-BnF8XhVE.mjs";
5
+ import { Document, createDocument } from "./document.mjs";
4
6
  import { Heading } from "./heading.mjs";
5
7
  import { Image } from "./image.mjs";
8
+ import { scrollCaretToTop, scrollContainerOf } from "./scroll.mjs";
9
+ import { Link } from "./link.mjs";
10
+ import { OrderedList } from "./ordered-list.mjs";
6
11
  import { Paragraph } from "./paragraph.mjs";
7
12
  import { Strike } from "./strike.mjs";
8
13
  import { Table } from "./table.mjs";
@@ -10,4 +15,4 @@ import { TableCell } from "./table-cell.mjs";
10
15
  import { TableHeader } from "./table-header.mjs";
11
16
  import { TableRow } from "./table-row.mjs";
12
17
  import { TextStyle } from "./text-style.mjs";
13
- export { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Document, DocxKit, Emoji, HardBreak, Heading, Highlight, HorizontalRule, Image, Italic, Link, ListItem, Mathematics, Mention, OrderedList, Paragraph, Passthrough, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TocField, Underline, WpgGroup, WpsShape, docxExtensions, tiptapMarkExtensions, tiptapNodeExtensions };
18
+ export { Blockquote, Bold, BulletList, Code, CodeBlock, CodeBlockLowlight, ColumnBreak, Details, DetailsContent, DetailsSummary, Document, DocxKit, Emoji, FormattingMarks, HardBreak, Heading, Highlight, HorizontalRule, Image, InlinePassthrough, Italic, Link, ListItem, Mathematics, Mention, OrderedList, PageBreak, Paragraph, Passthrough, SectionBreak, Strike, Subscript, Superscript, Tab, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TocField, Underline, WpgGroup, WpsShape, createDocument, docxExtensions, scrollCaretToTop, scrollContainerOf, tiptapMarkExtensions, tiptapNodeExtensions, wpsShapeStyles };