@docen/docx 0.3.0 → 0.3.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.
Files changed (110) hide show
  1. package/README.md +2 -3
  2. package/dist/blockquote-Ky9xD_Q-.mjs +31 -0
  3. package/dist/code-block-BgNjhADy.mjs +23 -0
  4. package/dist/converters/docx.d.mts +1 -109
  5. package/dist/converters/docx.mjs +1 -623
  6. package/dist/converters/html.d.mts +1 -13
  7. package/dist/converters/html.mjs +1 -17
  8. package/dist/converters/markdown.d.mts +1 -12
  9. package/dist/converters/markdown.mjs +1 -17
  10. package/dist/converters/patch.d.mts +1 -52
  11. package/dist/converters/patch.mjs +1 -36
  12. package/dist/converters/prepare.d.mts +2 -51
  13. package/dist/converters/prepare.mjs +2 -76
  14. package/dist/converters/styles.d.mts +2 -0
  15. package/dist/converters/styles.mjs +2 -0
  16. package/dist/core-DEqBHRzE.mjs +406 -0
  17. package/dist/core-fBMCCj4D.d.mts +97 -0
  18. package/dist/core.d.mts +1 -1
  19. package/dist/core.mjs +1 -1
  20. package/dist/details-Dh8luWb2.mjs +18 -0
  21. package/dist/dist-B6B3HnVZ.mjs +1838 -0
  22. package/dist/document-BH1y4qHM.d.mts +6 -0
  23. package/dist/document-CvTym-FM.mjs +50 -0
  24. package/dist/docx-C5wyjI-0.d.mts +200 -0
  25. package/dist/docx-CONyAedl.mjs +1231 -0
  26. package/dist/editor-Bf3CxQnY.mjs +21 -0
  27. package/dist/editor-DReY3Rb9.d.mts +21 -0
  28. package/dist/editor.d.mts +1 -20
  29. package/dist/editor.mjs +1 -19
  30. package/dist/emoji-BZ1dJD7d.d.mts +17 -0
  31. package/dist/emoji-C2OsTWR7.mjs +27 -0
  32. package/dist/extensions/blockquote.d.mts +23 -0
  33. package/dist/extensions/blockquote.mjs +3 -0
  34. package/dist/extensions/code-block.d.mts +19 -0
  35. package/dist/extensions/code-block.mjs +2 -0
  36. package/dist/extensions/column-break.d.mts +31 -0
  37. package/dist/extensions/column-break.mjs +2 -0
  38. package/dist/extensions/details.d.mts +19 -0
  39. package/dist/extensions/details.mjs +3 -0
  40. package/dist/extensions/document.d.mts +2 -0
  41. package/dist/extensions/document.mjs +2 -0
  42. package/dist/extensions/emoji.d.mts +2 -0
  43. package/dist/extensions/emoji.mjs +2 -0
  44. package/dist/extensions/extensions.d.mts +6 -5
  45. package/dist/extensions/extensions.mjs +14 -12
  46. package/dist/extensions/formatting-marks.d.mts +32 -0
  47. package/dist/extensions/formatting-marks.mjs +2 -0
  48. package/dist/extensions/heading.mjs +1 -144
  49. package/dist/extensions/image-group.d.mts +6 -0
  50. package/dist/extensions/image-group.mjs +2 -0
  51. package/dist/extensions/image.d.mts +2 -2
  52. package/dist/extensions/image.mjs +1 -200
  53. package/dist/extensions/index.d.mts +3 -2
  54. package/dist/extensions/index.mjs +3 -2
  55. package/dist/extensions/mention.d.mts +25 -0
  56. package/dist/extensions/mention.mjs +3 -0
  57. package/dist/extensions/ordered-list.d.mts +25 -0
  58. package/dist/extensions/ordered-list.mjs +3 -0
  59. package/dist/extensions/page-break.d.mts +34 -0
  60. package/dist/extensions/page-break.mjs +2 -0
  61. package/dist/extensions/paragraph.d.mts +1 -1
  62. package/dist/extensions/paragraph.mjs +1 -115
  63. package/dist/extensions/passthrough.d.mts +2 -0
  64. package/dist/extensions/passthrough.mjs +2 -0
  65. package/dist/extensions/section-break.d.mts +27 -0
  66. package/dist/extensions/section-break.mjs +2 -0
  67. package/dist/extensions/strike.mjs +1 -49
  68. package/dist/extensions/table-cell.mjs +1 -111
  69. package/dist/extensions/table-header.mjs +1 -111
  70. package/dist/extensions/table-row.mjs +1 -83
  71. package/dist/extensions/table.mjs +1 -133
  72. package/dist/extensions/task-item.d.mts +27 -0
  73. package/dist/extensions/task-item.mjs +3 -0
  74. package/dist/extensions/text-style.mjs +1 -133
  75. package/dist/extensions/tiptap.mjs +1 -32
  76. package/dist/extensions/types.d.mts +7 -5
  77. package/dist/extensions/utils.d.mts +16 -3
  78. package/dist/extensions/utils.mjs +2 -289
  79. package/dist/heading-DAubgJJN.mjs +166 -0
  80. package/dist/html-DCC_DSHv.d.mts +18 -0
  81. package/dist/html-DedDWPoO.mjs +66 -0
  82. package/dist/image-CuEIXoZl.mjs +334 -0
  83. package/dist/index.d.mts +68 -18
  84. package/dist/index.mjs +10 -8
  85. package/dist/markdown-BzJmRsBs.mjs +18 -0
  86. package/dist/markdown-D0k0sRYS.d.mts +13 -0
  87. package/dist/mention-C-dTR6MK.mjs +44 -0
  88. package/dist/ordered-list-V-3xFQmV.mjs +41 -0
  89. package/dist/paragraph-BrWH-BOV.mjs +147 -0
  90. package/dist/paragraph-D8mpHo_o.d.mts +8 -0
  91. package/dist/patch-Cdp5WKJz.d.mts +53 -0
  92. package/dist/patch-IZ13tXTu.mjs +36 -0
  93. package/dist/prepare-Bdk8Cjkf.mjs +122 -0
  94. package/dist/prepare-CPAvcv6q.d.mts +63 -0
  95. package/dist/strike-hWxShOgb.mjs +50 -0
  96. package/dist/styles-QSX3RhxK.mjs +285 -0
  97. package/dist/styles-ugspkrxz.d.mts +85 -0
  98. package/dist/table-DrA12lxX.mjs +159 -0
  99. package/dist/table-cell-DmkfYwDc.mjs +112 -0
  100. package/dist/table-header-Bwr5GKWg.mjs +112 -0
  101. package/dist/table-row-vew1y7WH.mjs +84 -0
  102. package/dist/task-item-BnlXGrIG.mjs +37 -0
  103. package/dist/text-style-tMeBq5XQ.mjs +151 -0
  104. package/dist/tiptap-D7pl4I5U.mjs +33 -0
  105. package/dist/utils-BPT4tjcn.mjs +333 -0
  106. package/package.json +3 -2
  107. package/dist/core-CFIQVRfx.mjs +0 -88
  108. package/dist/core-omBKMRtl.d.mts +0 -34
  109. package/dist/image-Ge1y6uam.d.mts +0 -47
  110. package/dist/paragraph-fhEXtAN2.d.mts +0 -16
@@ -0,0 +1,21 @@
1
+ import { s as docxExtensions, t as Editor } from "./core-DEqBHRzE.mjs";
2
+ //#region src/editor.ts
3
+ /**
4
+ * Create a Tiptap editor configured for DOCX editing.
5
+ */
6
+ function createDocxEditor(options) {
7
+ const { element, extensions: extraExtensions = [], content, spellcheck = true, editable = true } = options;
8
+ const extraNames = new Set(extraExtensions.map((e) => e.name).filter(Boolean));
9
+ return new Editor({
10
+ element,
11
+ extensions: [...docxExtensions.filter((e) => !extraNames.has(e.name)), ...extraExtensions],
12
+ content: content ?? {
13
+ type: "doc",
14
+ content: [{ type: "paragraph" }]
15
+ },
16
+ editable,
17
+ editorProps: { attributes: { spellcheck: spellcheck ? "true" : "false" } }
18
+ });
19
+ }
20
+ //#endregion
21
+ export { createDocxEditor as t };
@@ -0,0 +1,21 @@
1
+ import { n as Editor, t as AnyExtension } from "./core-fBMCCj4D.mjs";
2
+
3
+ //#region src/editor.d.ts
4
+ interface DocxEditorOptions {
5
+ /** DOM element to mount the editor */
6
+ element: HTMLElement;
7
+ /** Additional Tiptap extensions */
8
+ extensions?: AnyExtension[];
9
+ /** Initial content (Tiptap JSON or HTML string) */
10
+ content?: Record<string, unknown> | string;
11
+ /** Enable spellcheck (disable for large documents) */
12
+ spellcheck?: boolean;
13
+ /** Editor is editable */
14
+ editable?: boolean;
15
+ }
16
+ /**
17
+ * Create a Tiptap editor configured for DOCX editing.
18
+ */
19
+ declare function createDocxEditor(options: DocxEditorOptions): Editor;
20
+ //#endregion
21
+ export { createDocxEditor as n, DocxEditorOptions as t };
package/dist/editor.d.mts CHANGED
@@ -1,21 +1,2 @@
1
- import { n as Editor, t as AnyExtension } from "./core-omBKMRtl.mjs";
2
-
3
- //#region src/editor.d.ts
4
- interface DocxEditorOptions {
5
- /** DOM element to mount the editor */
6
- element: HTMLElement;
7
- /** Additional Tiptap extensions */
8
- extensions?: AnyExtension[];
9
- /** Initial content (Tiptap JSON or HTML string) */
10
- content?: Record<string, unknown> | string;
11
- /** Enable spellcheck (disable for large documents) */
12
- spellcheck?: boolean;
13
- /** Editor is editable */
14
- editable?: boolean;
15
- }
16
- /**
17
- * Create a Tiptap editor configured for DOCX editing.
18
- */
19
- declare function createDocxEditor(options: DocxEditorOptions): Editor;
20
- //#endregion
1
+ import { n as createDocxEditor, t as DocxEditorOptions } from "./editor-DReY3Rb9.mjs";
21
2
  export { DocxEditorOptions, createDocxEditor };
package/dist/editor.mjs CHANGED
@@ -1,20 +1,2 @@
1
- import { s as docxExtensions, t as Editor } from "./core-CFIQVRfx.mjs";
2
- //#region src/editor.ts
3
- /**
4
- * Create a Tiptap editor configured for DOCX editing.
5
- */
6
- function createDocxEditor(options) {
7
- const { element, extensions: extraExtensions = [], content, spellcheck = true, editable = true } = options;
8
- return new Editor({
9
- element,
10
- extensions: [...docxExtensions, ...extraExtensions],
11
- content: content ?? {
12
- type: "doc",
13
- content: [{ type: "paragraph" }]
14
- },
15
- editable,
16
- editorProps: { attributes: { spellcheck: spellcheck ? "true" : "false" } }
17
- });
18
- }
19
- //#endregion
1
+ import { t as createDocxEditor } from "./editor-Bf3CxQnY.mjs";
20
2
  export { createDocxEditor };
@@ -0,0 +1,17 @@
1
+ //#region src/extensions/emoji.d.ts
2
+ /**
3
+ * Custom Emoji extension — caches the resolved glyph for DOCX export.
4
+ *
5
+ * Base `@tiptap/extension-emoji` stores only `name` (a shortcode); the glyph
6
+ * itself is looked up from a dataset at render time. DOCX compile runs outside
7
+ * the editor (no dataset available), so we cache the resolved character in
8
+ * `attrs.emoji`, filled from the element's text content on `parseHTML`.
9
+ *
10
+ * DOCX has no emoji structure — a glyph is just a text run. Compile therefore
11
+ * emits `attrs.emoji` (falling back to the `:name:` shortcode) as plain text;
12
+ * resolve degrades DOCX text back to a text node (known lossy round-trip, like
13
+ * codeBlock's dropped `language`). HTML rendering is inherited from the base.
14
+ */
15
+ declare const Emoji: import("@tiptap/core").Node<import("@tiptap/extension-emoji").EmojiOptions, import("@tiptap/extension-emoji").EmojiStorage>;
16
+ //#endregion
17
+ export { Emoji as t };
@@ -0,0 +1,27 @@
1
+ import { d as Emoji$1 } from "./tiptap-D7pl4I5U.mjs";
2
+ //#region src/extensions/emoji.ts
3
+ /**
4
+ * Custom Emoji extension — caches the resolved glyph for DOCX export.
5
+ *
6
+ * Base `@tiptap/extension-emoji` stores only `name` (a shortcode); the glyph
7
+ * itself is looked up from a dataset at render time. DOCX compile runs outside
8
+ * the editor (no dataset available), so we cache the resolved character in
9
+ * `attrs.emoji`, filled from the element's text content on `parseHTML`.
10
+ *
11
+ * DOCX has no emoji structure — a glyph is just a text run. Compile therefore
12
+ * emits `attrs.emoji` (falling back to the `:name:` shortcode) as plain text;
13
+ * resolve degrades DOCX text back to a text node (known lossy round-trip, like
14
+ * codeBlock's dropped `language`). HTML rendering is inherited from the base.
15
+ */
16
+ const Emoji = Emoji$1.extend({ addAttributes() {
17
+ return {
18
+ ...this.parent?.(),
19
+ emoji: {
20
+ default: null,
21
+ rendered: false,
22
+ parseHTML: (el) => el.textContent || null
23
+ }
24
+ };
25
+ } });
26
+ //#endregion
27
+ export { Emoji as t };
@@ -0,0 +1,23 @@
1
+ import { t as Blockquote } from "../tiptap-TErPjuNJ.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
23
+ export { BLOCKQUOTE_BORDER, BLOCKQUOTE_INDENT_LEFT, Blockquote, applyBlockquoteStyle };
@@ -0,0 +1,3 @@
1
+ import { t as Blockquote } from "../tiptap-D7pl4I5U.mjs";
2
+ import { n as BLOCKQUOTE_INDENT_LEFT, r as applyBlockquoteStyle, t as BLOCKQUOTE_BORDER } from "../blockquote-Ky9xD_Q-.mjs";
3
+ export { BLOCKQUOTE_BORDER, BLOCKQUOTE_INDENT_LEFT, Blockquote, applyBlockquoteStyle };
@@ -0,0 +1,19 @@
1
+ import { a as JSONContent } from "../core-fBMCCj4D.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
19
+ export { CodeBlock, renderDocx };
@@ -0,0 +1,2 @@
1
+ import { n as renderDocx, t as CodeBlock } from "../code-block-BgNjhADy.mjs";
2
+ export { CodeBlock, renderDocx };
@@ -0,0 +1,31 @@
1
+ import { s as Node } from "../core-fBMCCj4D.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
31
+ export { ColumnBreak };
@@ -0,0 +1,2 @@
1
+ import { h as ColumnBreak } from "../core-DEqBHRzE.mjs";
2
+ export { ColumnBreak };
@@ -0,0 +1,19 @@
1
+ import { c as DetailsSummary, o as Details, s as DetailsContent } from "../tiptap-TErPjuNJ.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
19
+ export { DETAILS_SUMMARY_STYLE, DETAILS_TAG, Details, DetailsContent, DetailsSummary };
@@ -0,0 +1,3 @@
1
+ import { c as DetailsSummary, o as Details, s as DetailsContent } from "../tiptap-D7pl4I5U.mjs";
2
+ import { n as DETAILS_TAG, t as DETAILS_SUMMARY_STYLE } from "../details-Dh8luWb2.mjs";
3
+ export { DETAILS_SUMMARY_STYLE, DETAILS_TAG, Details, DetailsContent, DetailsSummary };
@@ -0,0 +1,2 @@
1
+ import { n as createDocument, t as Document } from "../document-BH1y4qHM.mjs";
2
+ export { Document, createDocument };
@@ -0,0 +1,2 @@
1
+ import { n as createDocument, t as Document } from "../document-CvTym-FM.mjs";
2
+ export { Document, createDocument };
@@ -0,0 +1,2 @@
1
+ import { t as Emoji } from "../emoji-BZ1dJD7d.mjs";
2
+ export { Emoji };
@@ -0,0 +1,2 @@
1
+ import { t as Emoji } from "../emoji-C2OsTWR7.mjs";
2
+ export { Emoji };
@@ -1,12 +1,13 @@
1
- import { B as UndoRedo, C as Mention, D as Subscript, F as Text, N as TaskItem, O as Superscript, P as TaskList, R as TrailingNode, S as Mathematics, a as CodeBlockLowlight, b as ListItem, c as DetailsSummary, d as Emoji, f as Gapcursor, g as HorizontalRule, h as Highlight, i as Code, l as Document, n as Bold, o as Details, p as HardBreak, r as BulletList, s as DetailsContent, t as Blockquote, u as Dropcursor, v as Italic, w as OrderedList, x as ListKeymap, y as Link, z as Underline } from "../tiptap-TErPjuNJ.mjs";
1
+ import { B as UndoRedo, C as Mention, D as Subscript, F as Text, N as TaskItem, O as Superscript, P as TaskList, R as TrailingNode, S as Mathematics, a as CodeBlockLowlight, b as ListItem, c as DetailsSummary, f as Gapcursor, g as HorizontalRule, h as Highlight, i as Code, n as Bold, o as Details, p as HardBreak, r as BulletList, s as DetailsContent, t as Blockquote, u as Dropcursor, v as Italic, w as OrderedList, x as ListKeymap, y as Link, z as Underline } from "../tiptap-TErPjuNJ.mjs";
2
+ import { t as Document } from "../document-BH1y4qHM.mjs";
3
+ import { t as Emoji } from "../emoji-BZ1dJD7d.mjs";
2
4
  import { t as Heading } from "../heading-BvqBD2zX.mjs";
3
- import { t as Image } from "../image-Ge1y6uam.mjs";
4
- import { t as Paragraph } from "../paragraph-fhEXtAN2.mjs";
5
+ import { c as DocxKit, d as docxExtensions, f as tiptapMarkExtensions, g as Image, l as DocxKitOptions, m as Passthrough, p as tiptapNodeExtensions, u as TextAlign } from "../core-fBMCCj4D.mjs";
6
+ import { t as Paragraph } from "../paragraph-D8mpHo_o.mjs";
5
7
  import { t as TableRow } from "../table-row-kgzYkZlW.mjs";
6
8
  import { t as Table } from "../table-BFkfeRp9.mjs";
7
9
  import { t as TableCell } from "../table-cell-D_FV4D2h.mjs";
8
10
  import { t as TableHeader } from "../table-header-KGQ2aEkP.mjs";
9
11
  import { t as Strike } from "../strike-BgWGvjKr.mjs";
10
12
  import { t as TextStyle } from "../text-style-BHdtXkMb.mjs";
11
- import { c as StarterKit, d as docxExtensions, f as tiptapMarkExtensions, l as StarterKitOptions, p as tiptapNodeExtensions, u as TextAlign } from "../core-omBKMRtl.mjs";
12
- export { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Document, Dropcursor, Emoji, Gapcursor, HardBreak, Heading, Highlight, HorizontalRule, Image, Italic, Link, ListItem, ListKeymap, Mathematics, Mention, OrderedList, Paragraph, StarterKit, StarterKitOptions, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TrailingNode, Underline, UndoRedo, docxExtensions, tiptapMarkExtensions, tiptapNodeExtensions };
13
+ export { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Document, DocxKit, DocxKitOptions, Dropcursor, Emoji, Gapcursor, HardBreak, Heading, Highlight, HorizontalRule, Image, Italic, Link, ListItem, ListKeymap, Mathematics, Mention, OrderedList, Paragraph, Passthrough, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TrailingNode, Underline, UndoRedo, docxExtensions, tiptapMarkExtensions, tiptapNodeExtensions };
@@ -1,12 +1,14 @@
1
- import { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Document, Dropcursor, Emoji, Gapcursor, HardBreak, Highlight, HorizontalRule, Italic, Link, ListItem, ListKeymap, Mathematics, Mention, OrderedList, Subscript, Superscript, TaskItem, TaskList, Text, TrailingNode, Underline, UndoRedo } from "./tiptap.mjs";
2
- import { Heading } from "./heading.mjs";
3
- import { Image } from "./image.mjs";
4
- import { Paragraph } from "./paragraph.mjs";
5
- import { Strike } from "./strike.mjs";
6
- import { Table } from "./table.mjs";
7
- import { TableCell } from "./table-cell.mjs";
8
- import { TableHeader } from "./table-header.mjs";
9
- import { TableRow } from "./table-row.mjs";
10
- import { TextStyle } from "./text-style.mjs";
11
- import { a as StarterKit, c as tiptapMarkExtensions, l as tiptapNodeExtensions, o as TextAlign, s as docxExtensions } from "../core-CFIQVRfx.mjs";
12
- export { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Document, Dropcursor, Emoji, Gapcursor, HardBreak, Heading, Highlight, HorizontalRule, Image, Italic, Link, ListItem, ListKeymap, Mathematics, Mention, OrderedList, Paragraph, StarterKit, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TrailingNode, Underline, UndoRedo, docxExtensions, tiptapMarkExtensions, tiptapNodeExtensions };
1
+ import { B as UndoRedo, C as Mention, D as Subscript, F as Text, N as TaskItem, O as Superscript, P as TaskList, R as TrailingNode, S as Mathematics, a as CodeBlockLowlight, b as ListItem, c as DetailsSummary, f as Gapcursor, g as HorizontalRule, h as Highlight, i as Code, n as Bold, o as Details, p as HardBreak, r as BulletList, s as DetailsContent, t as Blockquote, u as Dropcursor, v as Italic, w as OrderedList, x as ListKeymap, y as Link, z as Underline } from "../tiptap-D7pl4I5U.mjs";
2
+ import { a as DocxKit, c as tiptapMarkExtensions, d as Passthrough, l as tiptapNodeExtensions, o as TextAlign, s as docxExtensions } from "../core-DEqBHRzE.mjs";
3
+ import { t as Document } from "../document-CvTym-FM.mjs";
4
+ import { t as Emoji } from "../emoji-C2OsTWR7.mjs";
5
+ import { t as Heading } from "../heading-DAubgJJN.mjs";
6
+ import { t as Image } from "../image-CuEIXoZl.mjs";
7
+ import { t as Paragraph } from "../paragraph-BrWH-BOV.mjs";
8
+ import { t as Strike } from "../strike-hWxShOgb.mjs";
9
+ import { t as Table } from "../table-DrA12lxX.mjs";
10
+ import { t as TableCell } from "../table-cell-DmkfYwDc.mjs";
11
+ import { t as TableHeader } from "../table-header-Bwr5GKWg.mjs";
12
+ import { t as TableRow } from "../table-row-vew1y7WH.mjs";
13
+ import { t as TextStyle } from "../text-style-tMeBq5XQ.mjs";
14
+ export { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Document, DocxKit, Dropcursor, Emoji, Gapcursor, HardBreak, Heading, Highlight, HorizontalRule, Image, Italic, Link, ListItem, ListKeymap, Mathematics, Mention, OrderedList, Paragraph, Passthrough, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TrailingNode, Underline, UndoRedo, docxExtensions, tiptapMarkExtensions, tiptapNodeExtensions };
@@ -0,0 +1,32 @@
1
+ import { r as Extension } from "../core-fBMCCj4D.mjs";
2
+
3
+ //#region src/extensions/formatting-marks.d.ts
4
+ /**
5
+ * FormattingMarks — paints the non-printing paragraph mark via ProseMirror
6
+ * widget decorations.
7
+ *
8
+ * CSS `p::after { content: "…" }` does NOT work on a ProseMirror-managed
9
+ * paragraph: the view owns the DOM and the trailing-break kludge pushes the
10
+ * pseudo-element off the visible line, so the mark never appears (verified).
11
+ * Marijn Haverbeke endorses widget decorations for exactly this use case
12
+ * (https://discuss.prosemirror.net/t/1442). Each textblock gets a widget at its
13
+ * closing position (inside the textblock, so it stays on the content's line)
14
+ * holding a non-editable `<span class="docen-para-mark">`. `side: 1` keeps the
15
+ * mark to the right of a cursor resting at the paragraph end (the cursor always
16
+ * precedes its own paragraph mark).
17
+ *
18
+ * Glyph: a down-then-left return arrow (↲, U+21B2 "downwards arrow with tip
19
+ * leftwards" — the Enter-key glyph). Word/WPS use the pilcrow ¶ for paragraph
20
+ * marks; that down-then-left arrow is Word's line-break glyph — adopted here as
21
+ * the paragraph mark per the project's visual preference.
22
+ */
23
+ declare const FormattingMarks: Extension<any, any>;
24
+ declare module "@tiptap/core" {
25
+ interface Commands<ReturnType> {
26
+ formattingMarks: {
27
+ /** Toggle the non-printing paragraph marks on or off. */toggleFormattingMarks: () => ReturnType;
28
+ };
29
+ }
30
+ }
31
+ //#endregion
32
+ export { FormattingMarks };
@@ -0,0 +1,2 @@
1
+ import { m as FormattingMarks } from "../core-DEqBHRzE.mjs";
2
+ export { FormattingMarks };
@@ -1,145 +1,2 @@
1
- import { Heading as Heading$1 } from "./tiptap.mjs";
2
- import { alignmentFromElement, bordersFromElement, indentFromElement, renderParagraphStyles, shadingFromElement, spacingFromElement } from "./utils.mjs";
3
- //#region src/extensions/heading.ts
4
- /**
5
- * Heading extension with nested office-open attrs (mirrors Paragraph).
6
- *
7
- * Attrs mirror ParagraphPropertiesOptionsBase (alignment/indent/spacing/border/
8
- * shading/frame as nested objects + scalar OOXML properties) plus the inherited
9
- * Tiptap `level` (1-6, rendered: false). DOCX round-trip is near-identity:
10
- * renderDocx/parseDocx pass attrs through and only map `level` ↔ OOXML
11
- * `heading` (HeadingLevel literal). CSS conversion happens solely in
12
- * renderHTML via utils mappers.
13
- */
14
- const HEADING_COMPILE_MAP = {
15
- 1: "Heading1",
16
- 2: "Heading2",
17
- 3: "Heading3",
18
- 4: "Heading4",
19
- 5: "Heading5",
20
- 6: "Heading6"
21
- };
22
- const HEADING_PARSE_MAP = {
23
- Heading1: 1,
24
- Heading2: 2,
25
- Heading3: 3,
26
- Heading4: 4,
27
- Heading5: 5,
28
- Heading6: 6,
29
- Title: 1
30
- };
31
- function renderDocx(node) {
32
- const attrs = node.attrs ?? {};
33
- const opts = {};
34
- const level = attrs.level;
35
- if (level) opts.heading = HEADING_COMPILE_MAP[level] ?? "Heading1";
36
- for (const [key, value] of Object.entries(attrs)) {
37
- if (key === "level") continue;
38
- if (value !== null && value !== void 0) opts[key] = value;
39
- }
40
- return opts;
41
- }
42
- /** Structural/semantic keys expressed elsewhere (heading handled separately, list handling, run children). */
43
- const SKIP_KEYS = new Set([
44
- "heading",
45
- "style",
46
- "bullet",
47
- "numbering",
48
- "run",
49
- "children",
50
- "text",
51
- "thematicBreak"
52
- ]);
53
- function parseDocx(opts) {
54
- const resolved = typeof opts === "string" ? { text: opts } : opts;
55
- const attrs = {};
56
- if (resolved.heading) {
57
- const level = HEADING_PARSE_MAP[resolved.heading];
58
- if (level) attrs.level = level;
59
- }
60
- for (const [key, value] of Object.entries(resolved)) {
61
- if (SKIP_KEYS.has(key)) continue;
62
- attrs[key] = value ?? null;
63
- }
64
- return attrs;
65
- }
66
- const attrNative = () => ({
67
- default: null,
68
- parseHTML: () => null,
69
- rendered: false
70
- });
71
- const Heading = Heading$1.extend({
72
- addAttributes() {
73
- return {
74
- ...this.parent?.(),
75
- alignment: {
76
- default: null,
77
- rendered: false,
78
- parseHTML: (el) => alignmentFromElement(el)
79
- },
80
- indent: {
81
- default: null,
82
- rendered: false,
83
- parseHTML: (el) => indentFromElement(el)
84
- },
85
- spacing: {
86
- default: null,
87
- rendered: false,
88
- parseHTML: (el) => spacingFromElement(el)
89
- },
90
- shading: {
91
- default: null,
92
- rendered: false,
93
- parseHTML: (el) => shadingFromElement(el)
94
- },
95
- border: {
96
- default: null,
97
- rendered: false,
98
- parseHTML: (el) => bordersFromElement(el)
99
- },
100
- frame: attrNative(),
101
- keepNext: attrNative(),
102
- keepLines: attrNative(),
103
- pageBreakBefore: attrNative(),
104
- widowControl: attrNative(),
105
- contextualSpacing: attrNative(),
106
- bidirectional: attrNative(),
107
- outlineLevel: attrNative(),
108
- textDirection: attrNative(),
109
- textAlignment: attrNative(),
110
- suppressLineNumbers: attrNative(),
111
- wordWrap: attrNative(),
112
- overflowPunctuation: attrNative(),
113
- autoSpaceEastAsianText: attrNative(),
114
- suppressOverlap: attrNative(),
115
- suppressAutoHyphens: attrNative(),
116
- adjustRightInd: attrNative(),
117
- snapToGrid: attrNative(),
118
- mirrorIndents: attrNative(),
119
- kinsoku: attrNative(),
120
- topLinePunct: attrNative(),
121
- autoSpaceDE: attrNative(),
122
- textboxTightWrap: attrNative(),
123
- rightTabStop: attrNative(),
124
- leftTabStop: attrNative(),
125
- divId: attrNative(),
126
- tabStops: attrNative(),
127
- cnfStyle: attrNative()
128
- };
129
- },
130
- renderHTML({ node, HTMLAttributes }) {
131
- const styles = renderParagraphStyles(node.attrs);
132
- const level = node.attrs?.level ?? 1;
133
- const attrs = { ...HTMLAttributes };
134
- if (styles.length > 0) attrs.style = styles.join(";");
135
- return [
136
- `h${level}`,
137
- attrs,
138
- 0
139
- ];
140
- },
141
- renderDocx,
142
- parseDocx
143
- });
144
- //#endregion
1
+ import { n as parseDocx, r as renderDocx, t as Heading } from "../heading-DAubgJJN.mjs";
145
2
  export { Heading, parseDocx, renderDocx };
@@ -0,0 +1,6 @@
1
+ import { s as Node } from "../core-fBMCCj4D.mjs";
2
+
3
+ //#region src/extensions/image-group.d.ts
4
+ declare const ImageGroup: Node<any, any>;
5
+ //#endregion
6
+ export { ImageGroup };
@@ -0,0 +1,2 @@
1
+ import { p as ImageGroup } from "../core-DEqBHRzE.mjs";
2
+ export { ImageGroup };
@@ -1,2 +1,2 @@
1
- import { i as renderDocx, n as parseDocx, r as renderCropAttrs, t as Image } from "../image-Ge1y6uam.mjs";
2
- export { Image, parseDocx, renderCropAttrs, renderDocx };
1
+ import { _ as parseDocx, g as Image, h as CropRenderContext, v as renderCropAttrs, y as renderDocx } from "../core-fBMCCj4D.mjs";
2
+ export { CropRenderContext, Image, parseDocx, renderCropAttrs, renderDocx };