@docen/docx 0.3.1 → 0.3.3

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 (114) hide show
  1. package/dist/converters/docx.d.mts +220 -1
  2. package/dist/converters/docx.mjs +1352 -1
  3. package/dist/converters/html.d.mts +28 -1
  4. package/dist/converters/html.mjs +103 -1
  5. package/dist/converters/markdown.d.mts +12 -1
  6. package/dist/converters/markdown.mjs +17 -1
  7. package/dist/converters/patch.d.mts +52 -1
  8. package/dist/converters/patch.mjs +35 -1
  9. package/dist/converters/prepare.d.mts +62 -1
  10. package/dist/converters/prepare.mjs +121 -1
  11. package/dist/converters/styles.d.mts +91 -2
  12. package/dist/converters/styles.mjs +308 -2
  13. package/dist/core-B8ba_FNi.mjs +717 -0
  14. package/dist/core-DRaLI8nd.d.mts +203 -0
  15. package/dist/core.d.mts +1 -1
  16. package/dist/core.mjs +1 -1
  17. package/dist/document-Cws7XTYL.d.mts +28 -0
  18. package/dist/editor.d.mts +20 -1
  19. package/dist/editor.mjs +20 -1
  20. package/dist/extensions/blockquote.d.mts +1 -1
  21. package/dist/extensions/blockquote.mjs +30 -2
  22. package/dist/extensions/code-block.d.mts +1 -1
  23. package/dist/extensions/code-block.mjs +22 -1
  24. package/dist/extensions/column-break.d.mts +1 -1
  25. package/dist/extensions/column-break.mjs +1 -1
  26. package/dist/extensions/details.d.mts +1 -1
  27. package/dist/extensions/details.mjs +17 -2
  28. package/dist/extensions/document.d.mts +1 -1
  29. package/dist/extensions/document.mjs +45 -1
  30. package/dist/extensions/extensions.d.mts +4 -5
  31. package/dist/extensions/extensions.mjs +13 -14
  32. package/dist/extensions/formatting-marks.d.mts +7 -1
  33. package/dist/extensions/formatting-marks.mjs +1 -1
  34. package/dist/extensions/heading.mjs +187 -1
  35. package/dist/extensions/image.d.mts +1 -1
  36. package/dist/extensions/image.mjs +395 -1
  37. package/dist/extensions/index.d.mts +4 -3
  38. package/dist/extensions/index.mjs +4 -3
  39. package/dist/extensions/mention.d.mts +1 -1
  40. package/dist/extensions/mention.mjs +43 -2
  41. package/dist/extensions/ordered-list.d.mts +1 -1
  42. package/dist/extensions/ordered-list.mjs +40 -2
  43. package/dist/extensions/page-break.d.mts +1 -33
  44. package/dist/extensions/page-break.mjs +1 -1
  45. package/dist/extensions/paragraph.mjs +145 -1
  46. package/dist/extensions/passthrough.d.mts +1 -1
  47. package/dist/extensions/passthrough.mjs +1 -1
  48. package/dist/extensions/section-break.d.mts +19 -2
  49. package/dist/extensions/section-break.mjs +1 -1
  50. package/dist/extensions/strike.mjs +45 -1
  51. package/dist/extensions/table-cell.mjs +106 -1
  52. package/dist/extensions/table-header.mjs +106 -1
  53. package/dist/extensions/table-row.mjs +78 -1
  54. package/dist/extensions/table.mjs +154 -1
  55. package/dist/extensions/task-item.d.mts +1 -1
  56. package/dist/extensions/task-item.mjs +36 -2
  57. package/dist/extensions/text-style.mjs +145 -1
  58. package/dist/extensions/tiptap.d.mts +2 -2
  59. package/dist/extensions/tiptap.mjs +31 -2
  60. package/dist/extensions/toc-field.d.mts +2 -0
  61. package/dist/extensions/toc-field.mjs +2 -0
  62. package/dist/extensions/utils.d.mts +2 -62
  63. package/dist/extensions/utils.mjs +508 -2
  64. package/dist/extensions/wpg-group.d.mts +2 -0
  65. package/dist/extensions/wpg-group.mjs +2 -0
  66. package/dist/extensions/wps-shape.d.mts +2 -0
  67. package/dist/extensions/wps-shape.mjs +2 -0
  68. package/dist/index.d.mts +101 -29
  69. package/dist/index.mjs +13 -10
  70. package/dist/{tiptap-TErPjuNJ.d.mts → tiptap-pZsNPsvV.d.mts} +1 -3
  71. package/dist/utils-BJwDQts7.d.mts +137 -0
  72. package/package.json +39 -40
  73. package/dist/blockquote-Ky9xD_Q-.mjs +0 -31
  74. package/dist/code-block-BgNjhADy.mjs +0 -23
  75. package/dist/core-DEqBHRzE.mjs +0 -406
  76. package/dist/core-fBMCCj4D.d.mts +0 -97
  77. package/dist/details-Dh8luWb2.mjs +0 -18
  78. package/dist/dist-B6B3HnVZ.mjs +0 -1838
  79. package/dist/document-BH1y4qHM.d.mts +0 -6
  80. package/dist/document-CvTym-FM.mjs +0 -50
  81. package/dist/docx-C5wyjI-0.d.mts +0 -200
  82. package/dist/docx-CONyAedl.mjs +0 -1231
  83. package/dist/editor-Bf3CxQnY.mjs +0 -21
  84. package/dist/editor-DReY3Rb9.d.mts +0 -21
  85. package/dist/emoji-BZ1dJD7d.d.mts +0 -17
  86. package/dist/emoji-C2OsTWR7.mjs +0 -27
  87. package/dist/extensions/emoji.d.mts +0 -2
  88. package/dist/extensions/emoji.mjs +0 -2
  89. package/dist/extensions/image-group.d.mts +0 -6
  90. package/dist/extensions/image-group.mjs +0 -2
  91. package/dist/heading-DAubgJJN.mjs +0 -166
  92. package/dist/html-DCC_DSHv.d.mts +0 -18
  93. package/dist/html-DedDWPoO.mjs +0 -66
  94. package/dist/image-CuEIXoZl.mjs +0 -334
  95. package/dist/markdown-BzJmRsBs.mjs +0 -18
  96. package/dist/markdown-D0k0sRYS.d.mts +0 -13
  97. package/dist/mention-C-dTR6MK.mjs +0 -44
  98. package/dist/ordered-list-V-3xFQmV.mjs +0 -41
  99. package/dist/paragraph-BrWH-BOV.mjs +0 -147
  100. package/dist/patch-Cdp5WKJz.d.mts +0 -53
  101. package/dist/patch-IZ13tXTu.mjs +0 -36
  102. package/dist/prepare-Bdk8Cjkf.mjs +0 -122
  103. package/dist/prepare-CPAvcv6q.d.mts +0 -63
  104. package/dist/strike-hWxShOgb.mjs +0 -50
  105. package/dist/styles-QSX3RhxK.mjs +0 -285
  106. package/dist/styles-ugspkrxz.d.mts +0 -85
  107. package/dist/table-DrA12lxX.mjs +0 -159
  108. package/dist/table-cell-DmkfYwDc.mjs +0 -112
  109. package/dist/table-header-Bwr5GKWg.mjs +0 -112
  110. package/dist/table-row-vew1y7WH.mjs +0 -84
  111. package/dist/task-item-BnlXGrIG.mjs +0 -37
  112. package/dist/text-style-tMeBq5XQ.mjs +0 -151
  113. package/dist/tiptap-D7pl4I5U.mjs +0 -33
  114. package/dist/utils-BPT4tjcn.mjs +0 -333
package/dist/index.d.mts CHANGED
@@ -1,14 +1,16 @@
1
- import { n as createDocument, t as Document } from "./document-BH1y4qHM.mjs";
2
- import { a as JSONContent, c as DocxKit, d as docxExtensions, f as tiptapMarkExtensions, l as DocxKitOptions, p as tiptapNodeExtensions, t as AnyExtension } from "./core-fBMCCj4D.mjs";
3
- import { i as prepareDocument, n as PrepareStep, o as prepareImages, r as fetchImageHandler, t as ImageFetchHandler } from "./prepare-CPAvcv6q.mjs";
4
- import { a as generateDOCX, c as parseDOCX, i as compileDocument, l as resolveDocument, n as DocxGenerateOptions, o as generateDOCXStream, r as DocxManager, s as generateDOCXSync } from "./docx-C5wyjI-0.mjs";
5
- import { n as parseHTML, t as generateHTML } from "./html-DCC_DSHv.mjs";
6
- import { n as parseMarkdown, t as generateMarkdown } from "./markdown-D0k0sRYS.mjs";
7
- import { n as DocxPatchOptions, r as patchDOCX, t as DocxPatchContent } from "./patch-Cdp5WKJz.mjs";
8
- import { a as inlineStyles, i as effectiveRunProps, n as StylesOptions, o as quickStyles, s as stylesToCss, t as QuickStyleEntry } from "./styles-ugspkrxz.mjs";
9
- import { n as createDocxEditor, t as DocxEditorOptions } from "./editor-DReY3Rb9.mjs";
1
+ import { n as createDocument, t as Document } from "./document-Cws7XTYL.mjs";
2
+ import { a as JSONContent, c as PageBreak, f as docxExtensions, l as DocxKit, m as tiptapNodeExtensions, p as tiptapMarkExtensions, t as AnyExtension, u as DocxKitOptions } from "./core-DRaLI8nd.mjs";
3
+ import { A as twipsToMm, S as sectionMarginCss, b as resolvePageSize, x as sectionLinePitchCss, y as resolveFontName } from "./utils-BJwDQts7.mjs";
4
+ import { ImageFetchHandler, PrepareStep, fetchImageHandler, prepareDocument, prepareImages } from "./converters/prepare.mjs";
5
+ import { DocxGenerateOptions, DocxManager, compileDocument, generateDOCX, generateDOCXStream, generateDOCXSync, parseDOCX, resolveDocument } from "./converters/docx.mjs";
6
+ import { generateHTML, parseHTML } from "./converters/html.mjs";
7
+ import { generateMarkdown, parseMarkdown } from "./converters/markdown.mjs";
8
+ import { DocxPatchContent, DocxPatchOptions, patchDOCX } from "./converters/patch.mjs";
9
+ import { QuickStyleEntry, StylesOptions, effectiveRunProps, inlineStyles, quickStyles, stylesToCss } from "./converters/styles.mjs";
10
+ import { DocxEditorOptions, createDocxEditor } from "./editor.mjs";
10
11
  import { JSONContent as TiptapJSONContent } from "@tiptap/core";
11
- import { AlignmentType, BookmarkOptions, BorderOptions, BordersOptions, DocumentOptions, EmphasisMarkType, ExternalHyperlinkOptions, Floating, Floating as Floating$1, FontAttributesProperties, FrameOptions, HeadingLevel, HeightRule, HighlightColor, ImageChild, ImageOptions, ImageOptions as ImageOptions$1, IndentAttributesProperties, InternalHyperlinkOptions, LeaderType, LevelParagraphStylePropertiesOptions, LineRuleType, Margins, MathChild, MathInput, MediaTransformation, ParagraphChild, ParagraphOptions, ParagraphPropertiesOptions, ParagraphPropertiesOptionsBase, ParagraphRunPropertiesOptions, ParagraphStylePropertiesOptions, RubyOptions, RunOptions, RunPropertiesOptions, RunStylePropertiesOptions, SectionChild, SectionOptions, SectionPropertiesOptions, ShadingAttributesProperties, SpacingProperties, TabStopDefinition, TabStopPosition, TabStopType, TableBordersOptions, TableCellBordersOptions, TableCellOptions, TableFloatOptions, TableLayoutType, TableLookOptions, TableOptions, TableRowOptions, TableRowPropertiesOptionsBase, TableVerticalAlign, TableWidthProperties, TextAlignmentType, UnderlineType, WidthType } from "@office-open/docx";
12
+ import { AlignmentType, BookmarkOptions, BorderOptions, BordersOptions, DocumentOptions, EmphasisMarkType, ExternalHyperlinkOptions, Floating, Floating as Floating$1, FontAttributesProperties, FrameOptions, HeadingLevel, HeightRule, HighlightColor, ImageOptions, ImageOptions as ImageOptions$1, IndentAttributesProperties, InternalHyperlinkOptions, LeaderType, LevelParagraphStylePropertiesOptions, LineRuleType, Margins, MathInput, MediaTransformation, ParagraphChild, ParagraphOptions, ParagraphPropertiesOptions, ParagraphPropertiesOptionsBase, ParagraphRunPropertiesOptions, ParagraphStylePropertiesOptions, RubyOptions, RunOptions, RunPropertiesOptions, RunStylePropertiesOptions, SectionChild, SectionOptions, SectionPropertiesOptions, SectionPropertiesOptions as SectionPropertiesOptions$1, ShadingAttributesProperties, SpacingProperties, TabStopDefinition, TabStopPosition, TabStopType, TableBordersOptions, TableCellBordersOptions, TableCellOptions, TableFloatOptions, TableLayoutType, TableLookOptions, TableOptions, TableRowOptions, TableRowPropertiesOptionsBase, TableVerticalAlign, TableWidthProperties, TextAlignmentType, UnderlineType, WidthType, sectionMarginDefaults, sectionPageSizeDefaults } from "@office-open/docx";
13
+ import { convertMillimetersToTwip } from "@office-open/core";
12
14
 
13
15
  //#region src/types.d.ts
14
16
  /**
@@ -17,19 +19,44 @@ import { AlignmentType, BookmarkOptions, BorderOptions, BordersOptions, Document
17
19
  */
18
20
  type AttrNullable<T> = { [K in keyof T]-?: T[K] | null };
19
21
  /**
20
- * Paragraph and heading attrs — mirrors ParagraphPropertiesOptionsBase.
22
+ * Paragraph and heading attrs — mirrors ParagraphPropertiesOptionsBase, plus
23
+ * engine-only extras the office-open paragraph interface does not carry:
24
+ * styleId (OOXML pStyle, drives styles.xml CSS) and the section* attrs (OOXML
25
+ * sectPr lives on a section's last paragraph, so the engine hauls the section
26
+ * boundary + its header/footer slots on that paragraph).
21
27
  *
22
28
  * indent/spacing/border/run/frame are nested objects (matching office-open),
23
29
  * so one `indent` attr replaces 13 flattened indent attrs.
24
30
  */
25
- type ParagraphAttrs = AttrNullable<ParagraphPropertiesOptionsBase>;
31
+ type ParagraphAttrs = AttrNullable<ParagraphPropertiesOptionsBase> & {
32
+ styleId: string | null;
33
+ sectionProperties: SectionPropertiesOptions$1 | null;
34
+ sectionHeaders: HeaderFooterSlots | null;
35
+ sectionFooters: HeaderFooterSlots | null;
36
+ };
26
37
  /**
27
38
  * Text style mark attrs — mirrors RunStylePropertiesOptions.
28
39
  *
29
40
  * Omits properties handled by dedicated marks (bold, italic, strike,
30
41
  * doubleStrike, subScript, superScript). `size` is in POINTS.
31
42
  */
32
- type TextStyleAttrs = AttrNullable<Omit<RunStylePropertiesOptions, "bold" | "boldComplexScript" | "italic" | "italicComplexScript" | "strike" | "doubleStrike" | "subScript" | "superScript">>;
43
+ type TextStyleAttrs = AttrNullable<Omit<RunStylePropertiesOptions, "bold" | "boldComplexScript" | "italic" | "italicComplexScript" | "strike" | "doubleStrike" | "subScript" | "superScript">> & {
44
+ /** Named character style id (OOXML rStyle). Engine-only extra. */styleId: string | null;
45
+ };
46
+ /**
47
+ * Mention node attrs (official @tiptap/extension-mention).
48
+ */
49
+ interface MentionAttrs {
50
+ id: string | null;
51
+ label: string | null;
52
+ }
53
+ /**
54
+ * Mathematics node attrs (official @tiptap/extension-mathematics).
55
+ * Applies to both blockMath (block) and inlineMath (inline).
56
+ */
57
+ interface MathAttrs {
58
+ latex: string;
59
+ }
33
60
  /**
34
61
  * Link mark attrs.
35
62
  */
@@ -92,13 +119,11 @@ interface ImageAttrs {
92
119
  runPropertiesRawXml: string | null;
93
120
  }
94
121
  /**
95
- * Emoji node attrs.
96
- * `name` is the shortcode (base @tiptap/extension-emoji); `emoji` is the
97
- * resolved glyph cached for DOCX export (null when only the shortcode is known).
122
+ * Emoji node attrs. `name` is the shortcode (base @tiptap/extension-emoji); the
123
+ * glyph is resolved from the emoji dataset at DOCX-compile time.
98
124
  */
99
125
  interface EmojiAttrs {
100
126
  name: string | null;
101
- emoji: string | null;
102
127
  }
103
128
  /**
104
129
  * Strike mark attrs.
@@ -145,12 +170,12 @@ type Mark = {
145
170
  interface ParagraphNode extends TiptapJSONContent {
146
171
  type: "paragraph";
147
172
  attrs?: ParagraphAttrs;
148
- content?: Array<TextNode | HardBreakNode | ImageNode | EmojiNode>;
173
+ content?: InlineContent[];
149
174
  }
150
175
  interface HeadingNode extends TiptapJSONContent {
151
176
  type: "heading";
152
177
  attrs: {
153
- level: 1 | 2 | 3 | 4 | 5 | 6;
178
+ level: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
154
179
  } & ParagraphAttrs;
155
180
  content?: Array<TextNode | HardBreakNode>;
156
181
  }
@@ -185,9 +210,7 @@ interface BulletListNode extends TiptapJSONContent {
185
210
  interface OrderedListNode extends TiptapJSONContent {
186
211
  type: "orderedList";
187
212
  attrs?: {
188
- start?: number;
189
- order?: number;
190
- type?: string | null;
213
+ start?: number | null;
191
214
  };
192
215
  content?: Array<ListItemNode>;
193
216
  }
@@ -232,23 +255,72 @@ interface ImageNode extends TiptapJSONContent {
232
255
  }
233
256
  /**
234
257
  * Drawing group (wpg) carried as an opaque blob — the full WpgGroupRunOptions
235
- * (pictures/shapes/nested groups + transform) round-trips verbatim. The editor
236
- * doesn't model the group interior; renderHTML paints the first picture only.
258
+ * (pictures/shapes/nested groups + transform) round-trips verbatim. renderHTML
259
+ * lays out every child at its transformed position (Word-style group rendering).
237
260
  */
238
- interface ImageGroupNode extends TiptapJSONContent {
239
- type: "imageGroup";
261
+ interface WpgGroupNode extends TiptapJSONContent {
262
+ type: "wpgGroup";
240
263
  attrs?: {
241
264
  wpgGroup: Record<string, unknown> | null;
242
265
  };
243
266
  }
267
+ /**
268
+ * Standalone floating text-box shape (wp:anchor > wps:wsp) carried as an opaque
269
+ * blob — the full WpsShapeRunOptions round-trips verbatim. Unlike the group's
270
+ * interior wps children, this shape floats on its own anchor and renders via the
271
+ * shared wps interior renderer.
272
+ */
273
+ interface WpsShapeNode extends TiptapJSONContent {
274
+ type: "wpsShape";
275
+ attrs?: {
276
+ wpsShape: Record<string, unknown> | null;
277
+ };
278
+ }
244
279
  interface EmojiNode extends TiptapJSONContent {
245
280
  type: "emoji";
246
281
  attrs?: EmojiAttrs;
247
282
  }
283
+ interface PageBreakNode extends TiptapJSONContent {
284
+ type: "pageBreak";
285
+ }
286
+ interface ColumnBreakNode extends TiptapJSONContent {
287
+ type: "columnBreak";
288
+ }
289
+ interface MentionNode extends TiptapJSONContent {
290
+ type: "mention";
291
+ attrs?: MentionAttrs;
292
+ }
293
+ interface InlineMathNode extends TiptapJSONContent {
294
+ type: "inlineMath";
295
+ attrs?: MathAttrs;
296
+ }
297
+ interface BlockMathNode extends TiptapJSONContent {
298
+ type: "blockMath";
299
+ attrs?: MathAttrs;
300
+ }
301
+ interface PassthroughNode extends TiptapJSONContent {
302
+ type: "passthrough";
303
+ attrs?: {
304
+ data: string;
305
+ };
306
+ }
248
307
  interface DetailsNode extends TiptapJSONContent {
249
308
  type: "details";
250
309
  content?: Array<DetailsSummaryNode | DetailsContentNode>;
251
310
  }
311
+ /**
312
+ * TOC field node (`tocField`) — a block container whose `content` is the
313
+ * editable TOC entry paragraphs. `attrs.options` carries the TOC field switches
314
+ * (hyperlink, headingStyleRange, …). Named `tocField` (not `tableOfContents`)
315
+ * to avoid the @tiptap/extension-table-of-contents name. See TocField extension.
316
+ */
317
+ interface TocFieldNode extends TiptapJSONContent {
318
+ type: "tocField";
319
+ attrs?: {
320
+ options: Record<string, unknown> | null;
321
+ };
322
+ content?: Array<BlockNode>;
323
+ }
252
324
  interface DetailsSummaryNode extends TiptapJSONContent {
253
325
  type: "detailsSummary";
254
326
  content?: Array<TextNode | HardBreakNode>;
@@ -257,7 +329,7 @@ interface DetailsContentNode extends TiptapJSONContent {
257
329
  type: "detailsContent";
258
330
  content?: Array<BlockNode>;
259
331
  }
260
- type InlineContent = TextNode | HardBreakNode;
261
- type BlockNode = ParagraphNode | HeadingNode | BlockquoteNode | CodeBlockNode | HorizontalRuleNode | BulletListNode | OrderedListNode | TaskListNode | TableNode | ImageNode | DetailsNode;
332
+ type InlineContent = TextNode | HardBreakNode | ImageNode | EmojiNode | PageBreakNode | ColumnBreakNode | MentionNode | InlineMathNode;
333
+ type BlockNode = ParagraphNode | HeadingNode | BlockquoteNode | CodeBlockNode | HorizontalRuleNode | BulletListNode | OrderedListNode | TaskListNode | TableNode | WpsShapeNode | WpgGroupNode | DetailsNode | TocFieldNode | PassthroughNode | BlockMathNode;
262
334
  //#endregion
263
- export { type AlignmentType, type AnyExtension, type AttrNullable, type BlockNode, type BlockquoteNode, type BookmarkOptions, type BorderOptions, type BordersOptions, type BulletListNode, type CodeBlockNode, type DetailsContentNode, type DetailsNode, type DetailsSummaryNode, Document, type DocumentOptions, type DocxEditorOptions, type DocxGenerateOptions, DocxKit, type DocxKitOptions, DocxManager, type DocxPatchContent, type DocxPatchOptions, type EmojiAttrs, type EmojiNode, type EmphasisMarkType, type ExternalHyperlinkOptions, type Floating, type FontAttributesProperties, type FrameOptions, type HardBreakNode, type HeaderFooterSlots, type HeadingLevel, type HeadingNode, type HeightRule, type HighlightColor, type HorizontalRuleNode, type ImageAttrs, type ImageChild, type ImageFetchHandler, type ImageGroupNode, type ImageNode, type ImageOptions, type IndentAttributesProperties, type InlineContent, type InternalHyperlinkOptions, type JSONContent, type LeaderType, type LevelParagraphStylePropertiesOptions, type LineRuleType, type LinkAttrs, type ListItemNode, type Margins, type Mark, type MathChild, type MathInput, type MediaTransformation, type OrderedListNode, type ParagraphAttrs, type ParagraphChild, type ParagraphNode, type ParagraphOptions, type ParagraphPropertiesOptions, type ParagraphPropertiesOptionsBase, type ParagraphRunPropertiesOptions, type ParagraphStylePropertiesOptions, type PrepareStep, type QuickStyleEntry, type RubyOptions, type RunOptions, type RunPropertiesOptions, type RunStylePropertiesOptions, type SectionChild, type SectionOptions, type SectionPropertiesOptions, type ShadingAttributesProperties, type SpacingProperties, type StrikeAttrs, type StylesOptions, type TabStopDefinition, type TabStopPosition, type TabStopType, type TableAttrs, type TableBordersOptions, type TableCellAttrs, type TableCellBordersOptions, type TableCellNode, type TableCellOptions, type TableFloatOptions, type TableHeaderNode, type TableLayoutType, type TableLookOptions, type TableNode, type TableOptions, type TableRowAttrs, type TableRowNode, type TableRowOptions, type TableRowPropertiesOptionsBase, type TableVerticalAlign, type TableWidthProperties, type TaskItemNode, type TaskListNode, type TextAlignmentType, type TextNode, type TextStyleAttrs, type UnderlineType, type WidthType, compileDocument, createDocument, createDocxEditor, docxExtensions, effectiveRunProps, fetchImageHandler, generateDOCX, generateDOCXStream, generateDOCXSync, generateHTML, generateMarkdown, inlineStyles, parseDOCX, parseHTML, parseMarkdown, patchDOCX, prepareDocument, prepareImages, quickStyles, resolveDocument, stylesToCss, tiptapMarkExtensions, tiptapNodeExtensions };
335
+ export { type AlignmentType, type AnyExtension, type AttrNullable, type BlockMathNode, type BlockNode, type BlockquoteNode, type BookmarkOptions, type BorderOptions, type BordersOptions, type BulletListNode, type CodeBlockNode, type ColumnBreakNode, type DetailsContentNode, type DetailsNode, type DetailsSummaryNode, Document, type DocumentOptions, type DocxEditorOptions, type DocxGenerateOptions, DocxKit, type DocxKitOptions, DocxManager, type DocxPatchContent, type DocxPatchOptions, type EmojiAttrs, type EmojiNode, type EmphasisMarkType, type ExternalHyperlinkOptions, type Floating, type FontAttributesProperties, type FrameOptions, type HardBreakNode, type HeaderFooterSlots, type HeadingLevel, type HeadingNode, type HeightRule, type HighlightColor, type HorizontalRuleNode, type ImageAttrs, type ImageFetchHandler, type ImageNode, type ImageOptions, type IndentAttributesProperties, type InlineContent, type InlineMathNode, type InternalHyperlinkOptions, type JSONContent, type LeaderType, type LevelParagraphStylePropertiesOptions, type LineRuleType, type LinkAttrs, type ListItemNode, type Margins, type Mark, type MathAttrs, type MathInput, type MediaTransformation, type MentionAttrs, type MentionNode, type OrderedListNode, PageBreak, type PageBreakNode, type ParagraphAttrs, type ParagraphChild, type ParagraphNode, type ParagraphOptions, type ParagraphPropertiesOptions, type ParagraphPropertiesOptionsBase, type ParagraphRunPropertiesOptions, type ParagraphStylePropertiesOptions, type PassthroughNode, type PrepareStep, type QuickStyleEntry, type RubyOptions, type RunOptions, type RunPropertiesOptions, type RunStylePropertiesOptions, type SectionChild, type SectionOptions, type SectionPropertiesOptions, type ShadingAttributesProperties, type SpacingProperties, type StrikeAttrs, type StylesOptions, type TabStopDefinition, type TabStopPosition, type TabStopType, type TableAttrs, type TableBordersOptions, type TableCellAttrs, type TableCellBordersOptions, type TableCellNode, type TableCellOptions, type TableFloatOptions, type TableHeaderNode, type TableLayoutType, type TableLookOptions, type TableNode, type TableOptions, type TableRowAttrs, type TableRowNode, type TableRowOptions, type TableRowPropertiesOptionsBase, type TableVerticalAlign, type TableWidthProperties, type TaskItemNode, type TaskListNode, type TextAlignmentType, type TextNode, type TextStyleAttrs, type TocFieldNode, type UnderlineType, type WidthType, type WpgGroupNode, type WpsShapeNode, compileDocument, convertMillimetersToTwip, createDocument, createDocxEditor, docxExtensions, effectiveRunProps, fetchImageHandler, generateDOCX, generateDOCXStream, generateDOCXSync, generateHTML, generateMarkdown, inlineStyles, parseDOCX, parseHTML, parseMarkdown, patchDOCX, prepareDocument, prepareImages, quickStyles, resolveDocument, resolveFontName, resolvePageSize, sectionLinePitchCss, sectionMarginCss, sectionMarginDefaults, sectionPageSizeDefaults, stylesToCss, tiptapMarkExtensions, tiptapNodeExtensions, twipsToMm };
package/dist/index.mjs CHANGED
@@ -1,10 +1,13 @@
1
- import { a as DocxKit, c as tiptapMarkExtensions, l as tiptapNodeExtensions, s as docxExtensions } from "./core-DEqBHRzE.mjs";
2
- import { n as createDocument, t as Document } from "./document-CvTym-FM.mjs";
3
- import { t as createDocxEditor } from "./editor-Bf3CxQnY.mjs";
4
- import { i as prepareImages, n as prepareDocument, t as fetchImageHandler } from "./prepare-Bdk8Cjkf.mjs";
5
- import { a as generateDOCXSync, i as generateDOCXStream, n as compileDocument, o as parseDOCX, r as generateDOCX, s as resolveDocument, t as DocxManager } from "./docx-CONyAedl.mjs";
6
- import { t as patchDOCX } from "./patch-IZ13tXTu.mjs";
7
- import { n as parseHTML, t as generateHTML } from "./html-DedDWPoO.mjs";
8
- import { n as parseMarkdown, t as generateMarkdown } from "./markdown-BzJmRsBs.mjs";
9
- import { a as stylesToCss, i as quickStyles, n as effectiveRunProps, r as inlineStyles } from "./styles-QSX3RhxK.mjs";
10
- export { Document, DocxKit, DocxManager, compileDocument, createDocument, createDocxEditor, docxExtensions, effectiveRunProps, fetchImageHandler, generateDOCX, generateDOCXStream, generateDOCXSync, generateHTML, generateMarkdown, inlineStyles, parseDOCX, parseHTML, parseMarkdown, patchDOCX, prepareDocument, prepareImages, quickStyles, resolveDocument, stylesToCss, tiptapMarkExtensions, tiptapNodeExtensions };
1
+ import { _ as PageBreak, a as DocxKit, c as tiptapMarkExtensions, l as tiptapNodeExtensions, s as docxExtensions } from "./core-B8ba_FNi.mjs";
2
+ import { resolveFontName, resolvePageSize, sectionLinePitchCss, sectionMarginCss, twipsToMm } from "./extensions/utils.mjs";
3
+ import { Document, createDocument } from "./extensions/document.mjs";
4
+ import { createDocxEditor } from "./editor.mjs";
5
+ import { fetchImageHandler, prepareDocument, prepareImages } from "./converters/prepare.mjs";
6
+ import { effectiveRunProps, inlineStyles, quickStyles, stylesToCss } from "./converters/styles.mjs";
7
+ import { DocxManager, compileDocument, generateDOCX, generateDOCXStream, generateDOCXSync, parseDOCX, resolveDocument } from "./converters/docx.mjs";
8
+ import { patchDOCX } from "./converters/patch.mjs";
9
+ import { generateHTML, parseHTML } from "./converters/html.mjs";
10
+ import { generateMarkdown, parseMarkdown } from "./converters/markdown.mjs";
11
+ import { sectionMarginDefaults, sectionPageSizeDefaults } from "@office-open/docx";
12
+ import { convertMillimetersToTwip } from "@office-open/core";
13
+ export { Document, DocxKit, DocxManager, PageBreak, compileDocument, convertMillimetersToTwip, createDocument, createDocxEditor, docxExtensions, effectiveRunProps, fetchImageHandler, generateDOCX, generateDOCXStream, generateDOCXSync, generateHTML, generateMarkdown, inlineStyles, parseDOCX, parseHTML, parseMarkdown, patchDOCX, prepareDocument, prepareImages, quickStyles, resolveDocument, resolveFontName, resolvePageSize, sectionLinePitchCss, sectionMarginCss, sectionMarginDefaults, sectionPageSizeDefaults, stylesToCss, tiptapMarkExtensions, tiptapNodeExtensions, twipsToMm };
@@ -28,6 +28,4 @@ import { Subscript } from "@tiptap/extension-subscript";
28
28
  import { Superscript } from "@tiptap/extension-superscript";
29
29
  import { TextStyle } from "@tiptap/extension-text-style";
30
30
  import { TextAlign } from "@tiptap/extension-text-align";
31
- import { Dropcursor, Gapcursor, TrailingNode, UndoRedo } from "@tiptap/extensions";
32
- import { ListKeymap } from "@tiptap/extension-list";
33
- export { TableCell as A, UndoRedo as B, Mention as C, Subscript as D, Strike as E, Text as F, TextAlign as I, TextStyle as L, TableRow as M, TaskItem as N, Superscript as O, TaskList as P, TrailingNode as R, Mathematics as S, Paragraph as T, Image as _, CodeBlockLowlight as a, ListItem as b, DetailsSummary as c, Emoji as d, Gapcursor as f, HorizontalRule as g, Highlight as h, Code as i, TableHeader as j, Table as k, Document as l, Heading as m, Bold as n, Details as o, HardBreak as p, BulletList as r, DetailsContent as s, Blockquote as t, Dropcursor as u, Italic as v, OrderedList as w, ListKeymap as x, Link as y, Underline as z };
31
+ export { TaskItem as A, Strike as C, TableCell as D, Table as E, Underline as F, Text as M, TextAlign as N, TableHeader as O, TextStyle as P, Paragraph as S, Superscript as T, Link as _, CodeBlockLowlight as a, Mention as b, DetailsSummary as c, HardBreak as d, Heading as f, Italic as g, Image as h, Code as i, TaskList as j, TableRow as k, Document as l, HorizontalRule as m, Bold as n, Details as o, Highlight as p, BulletList as r, DetailsContent as s, Blockquote as t, Emoji as u, ListItem as v, Subscript as w, OrderedList as x, Mathematics as y };
@@ -0,0 +1,137 @@
1
+ import { BorderOptions, BordersOptions, IndentAttributesProperties, ShadingAttributesProperties, SpacingProperties } from "@office-open/docx";
2
+
3
+ //#region src/extensions/utils.d.ts
4
+ /** Factory for a Tiptap attr that carries an office-open native value: never
5
+ * parsed from HTML nor rendered to it, defaulting to null (ProseMirror stores
6
+ * every declared attr). Shared by every extension carrying OOXML attrs
7
+ * (paragraph/heading/table/table-cell/…). */
8
+ declare const attrNative: () => {
9
+ default: null;
10
+ parseHTML: () => null;
11
+ rendered: boolean;
12
+ };
13
+ /** Normalize a CSS color value to hex (e.g., "red" → "#FF0000", "#ff0000" → "#FF0000").
14
+ * Accepts a string (CSS name/hex or bare OOXML hex), or an OOXML ColorOptions
15
+ * object ({ val, themeColor, themeTint, themeShade }) — the object form
16
+ * resolves to its val (the RGB fallback Word stores alongside themeColor) for
17
+ * CSS rendering. The themeColor/tint/shade are preserved verbatim in the attrs
18
+ * and round-trip back to the DOCX (see text-style/paragraph parseDocx), so
19
+ * theme semantics survive even though only val is rendered here. A pure theme
20
+ * reference with no val (rare — Word usually stores both) would need theme.xml
21
+ * to resolve and is left unset. */
22
+ declare function normalizeColorToHex(color: unknown): string | undefined;
23
+ /** Resolve a font value (string or OOXML rFonts { ascii, eastAsia, hAnsi, cs }) to a CSS family name. */
24
+ declare function resolveFontName(font: unknown): string | null;
25
+ /** Resolve a font value to a CSS font-family list with an eastAsia fallback.
26
+ * Mirrors Word's per-Unicode-range font selection (MS-OE376): Basic Latin uses
27
+ * the ascii font, CJK Ideographs use eastAsia. CSS can't split a run by range,
28
+ * so list ascii first (it carries Basic Latin glyphs) then eastAsia — the
29
+ * browser falls back to eastAsia for CJK chars the ascii font lacks. Without
30
+ * this, CJK text renders in the ascii font (e.g. Times) instead of the
31
+ * document's CJK font (e.g. SimSun). Use this for font-family rendering;
32
+ * resolveFontName (single name) stays for UI/parse. */
33
+ declare function resolveFontFamilyCss(font: unknown): string | null;
34
+ /** CSS value (e.g., "18pt") → twip number. 1 pt = 20 twips, 1 px = 15 twips (96 DPI). */
35
+ declare function cssToTwip(value: string | undefined): number | undefined;
36
+ /** Twip value → CSS string (e.g., 360 → "18pt"). */
37
+ declare function twipToCss(value: number | string | undefined): string | null;
38
+ /** OOXML alignment → CSS text-align. */
39
+ declare function alignmentToCss(alignment: string | null | undefined): string | null;
40
+ /** CSS text-align → OOXML alignment. */
41
+ declare function alignmentFromCss(css: string | null | undefined): string | null;
42
+ /** Shading.fill → CSS background-color hex. */
43
+ declare function shadingToCss(shading: ShadingAttributesProperties | null | undefined): string | null;
44
+ /** CSS background-color → ShadingAttributesProperties (fill normalized to hex). */
45
+ declare function shadingFromCss(css: string | null | undefined): ShadingAttributesProperties | null;
46
+ declare function lineSpacingToCss(spacing: SpacingProperties | null | undefined, snapToGrid?: boolean | null): string | null;
47
+ /** twips → mm (1 in = 1440 tw = 25.4 mm), 2dp string. */
48
+ declare function twipsToMm(twips: number): string;
49
+ /** Resolve a section's printable page dimensions (twips), honoring orientation.
50
+ * A landscape section commonly stores portrait dims (w<h) with
51
+ * `orientation: "landscape"` — swap width/height so width is the larger edge.
52
+ * Falls back to the engine's default page size (@office-open/docx
53
+ * `sectionPageSizeDefaults` = A4) when the size is absent or non-numeric — the
54
+ * engine's `stringifySectionPropertiesXml` fills an empty sectPr the same way,
55
+ * so edit-time geometry matches render/measure/generate/export. */
56
+ declare function resolvePageSize(size: unknown): {
57
+ width: number;
58
+ height: number;
59
+ };
60
+ /** Page margin (twips) → CSS padding. Sides absent or non-numeric fall back to
61
+ * the engine's default margins (@office-open/docx `sectionMarginDefaults`:
62
+ * top/bottom 1440tw, left/right 1800tw — MS Office zh-CN "Normal"), matching
63
+ * the page-size fallback above and the engine's empty-sectPr behavior. Margins
64
+ * are left as-is: office-open returns them already rotated for a landscape
65
+ * section. */
66
+ declare function sectionMarginCss(margin: unknown): string;
67
+ /** Document grid linePitch (twips) → container CSS line-height.
68
+ * Per ECMA-376 snapToGrid, the grid linePitch is ADDED to each line (single-
69
+ * line paragraphs inherit it). So the container line-height (inherited by
70
+ * paragraphs without their own spacing) is the font's `normal` metric + the
71
+ * grid pitch, set only when the grid type enables line-snapping (not
72
+ * "default"). The --docen-line-pitch var carries the pitch so per-paragraph
73
+ * lineSpacingToCss can add the same pitch; --docen-font-metric is injected per
74
+ * paragraph by the editor; 1.2 is the fallback for static HTML export. */
75
+ declare function sectionLinePitchCss(grid: unknown): string[];
76
+ declare function sizeToCss(size: number | null | undefined): string | null;
77
+ declare function sizeFromCss(css: string | null | undefined): number | null;
78
+ declare function characterSpacingToCss(spacing: number | null | undefined): string | null;
79
+ declare function characterSpacingFromCss(css: string | null | undefined): number | null;
80
+ /** Render a BorderOptions to CSS string. OOXML border.size is in eighths of a point. */
81
+ declare function renderBorderCSS(border: BorderOptions): string | null;
82
+ /**
83
+ * Render a drawing's Floating anchor (wp:anchor) to CSS — shared by Image and
84
+ * WpgGroup so anchored drawings render consistently:
85
+ * - wrapNone (type 0): position:absolute at the EMU offset (text does not flow
86
+ * around it — "in front of text" / "behind text"); z-index lifts it above or
87
+ * below the text layer per behindDocument.
88
+ * - topAndBottom (3): float + clear:both.
89
+ * - square/tight/through (1/2/4): with an hPos.offset, float:right pulled to
90
+ * the offset via margin-right so text wraps beside it with no overlap;
91
+ * otherwise float on the wrap side (tight/through add shape-outside, src).
92
+ * Wrap margins (wp:distT/B/L/R) are EMU, rendered as pt.
93
+ */
94
+ declare function floatingToStyles(floating: unknown, src?: string, width?: number): string[];
95
+ /**
96
+ * Where a wrapNone floating drawing's absolute top/left should resolve from.
97
+ *
98
+ * verticalPosition.relative (OOXML vRelativeFrom) defaults to "paragraph"
99
+ * (also "line"); "page"/"margin"/"column" scope to the page box. The drawing is
100
+ * position:absolute, so its offsetParent decides the origin: a
101
+ * paragraph-anchored drawing must sit inside a position:relative <p> (the editor
102
+ * CSS adds that via p:has([data-float-anchor])), otherwise top/left measure
103
+ * from the page top and the drawing floats over the heading/body instead of
104
+ * its own blank paragraph (verified on sample anchored drawing groups). Only
105
+ * relevant for wrapNone (type 0); the float-based wraps stay inline.
106
+ */
107
+ declare function floatAnchorScope(floating: unknown): "paragraph" | "page";
108
+ /**
109
+ * Compute all paragraph-level CSS styles from nested attrs.
110
+ * Shared by Paragraph and Heading extensions for node-level renderHTML.
111
+ * Attrs store office-open native values; mappers here convert to CSS.
112
+ */
113
+ declare function renderParagraphStyles(attrs: Record<string, unknown>, opts?: {
114
+ empty?: boolean;
115
+ }): string[];
116
+ /**
117
+ * Compute run-level CSS (font/size/color/weight/…) from office-open run attrs.
118
+ * Shared by text-style marks and the styles→CSS generator (stylesToCss).
119
+ */
120
+ declare function renderRunStyles(attrs: Record<string, unknown>): string[];
121
+ /**
122
+ * Compute table cell CSS styles from nested attrs.
123
+ * Shared by TableCell and TableHeader extensions.
124
+ */
125
+ declare function renderTableCellStyles(attrs: Record<string, unknown>): string[];
126
+ /** Parse text-align → OOXML alignment. */
127
+ declare function alignmentFromElement(el: HTMLElement): string | null;
128
+ /** Parse margin-left/right + text-indent → OOXML indent (twips). */
129
+ declare function indentFromElement(el: HTMLElement): IndentAttributesProperties | null;
130
+ /** Parse margin-top/bottom + line-height → OOXML spacing (twips). */
131
+ declare function spacingFromElement(el: HTMLElement): SpacingProperties | null;
132
+ /** Parse border-* → OOXML BordersOptions. */
133
+ declare function bordersFromElement(el: HTMLElement): BordersOptions | null;
134
+ /** Parse background-color → OOXML shading. */
135
+ declare function shadingFromElement(el: HTMLElement): ShadingAttributesProperties | null;
136
+ //#endregion
137
+ export { twipsToMm as A, shadingFromCss as C, sizeToCss as D, sizeFromCss as E, spacingFromElement as O, sectionMarginCss as S, shadingToCss as T, renderTableCellStyles as _, bordersFromElement as a, resolvePageSize as b, cssToTwip as c, indentFromElement as d, lineSpacingToCss as f, renderRunStyles as g, renderParagraphStyles as h, attrNative as i, twipToCss as k, floatAnchorScope as l, renderBorderCSS as m, alignmentFromElement as n, characterSpacingFromCss as o, normalizeColorToHex as p, alignmentToCss as r, characterSpacingToCss as s, alignmentFromCss as t, floatingToStyles as u, resolveFontFamilyCss as v, shadingFromElement as w, sectionLinePitchCss as x, resolveFontName as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docen/docx",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "DOCX editor and converter powered by @office-open/docx with Tiptap editing layer, supporting bidirectional conversion between DOCX, HTML, and Markdown",
5
5
  "keywords": [
6
6
  "converter",
@@ -59,46 +59,45 @@
59
59
  }
60
60
  },
61
61
  "dependencies": {
62
- "@office-open/docx": "0.10.0",
63
- "@tiptap/core": "3.22.5",
64
- "@tiptap/extension-blockquote": "3.22.5",
65
- "@tiptap/extension-bold": "3.22.5",
66
- "@tiptap/extension-bullet-list": "3.22.5",
67
- "@tiptap/extension-code": "3.22.5",
68
- "@tiptap/extension-code-block": "3.22.5",
69
- "@tiptap/extension-code-block-lowlight": "3.22.5",
70
- "@tiptap/extension-details": "3.22.5",
71
- "@tiptap/extension-document": "3.22.5",
72
- "@tiptap/extension-emoji": "3.22.5",
73
- "@tiptap/extension-hard-break": "3.22.5",
74
- "@tiptap/extension-heading": "3.22.5",
75
- "@tiptap/extension-highlight": "3.22.5",
76
- "@tiptap/extension-horizontal-rule": "3.22.5",
77
- "@tiptap/extension-image": "3.22.5",
78
- "@tiptap/extension-italic": "3.22.5",
79
- "@tiptap/extension-link": "3.22.5",
80
- "@tiptap/extension-list": "3.22.5",
81
- "@tiptap/extension-list-item": "3.22.5",
82
- "@tiptap/extension-mathematics": "3.22.5",
83
- "@tiptap/extension-mention": "3.22.5",
84
- "@tiptap/extension-ordered-list": "3.22.5",
85
- "@tiptap/extension-paragraph": "3.22.5",
86
- "@tiptap/extension-strike": "3.22.5",
87
- "@tiptap/extension-subscript": "3.22.5",
88
- "@tiptap/extension-superscript": "3.22.5",
89
- "@tiptap/extension-table": "3.22.5",
90
- "@tiptap/extension-task-item": "3.22.5",
91
- "@tiptap/extension-task-list": "3.22.5",
92
- "@tiptap/extension-text": "3.22.5",
93
- "@tiptap/extension-text-align": "3.22.5",
94
- "@tiptap/extension-text-style": "3.22.5",
95
- "@tiptap/extension-underline": "3.22.5",
96
- "@tiptap/extensions": "3.22.5",
97
- "@tiptap/html": "3.22.5",
98
- "@tiptap/markdown": "3.22.5",
99
- "@tiptap/pm": "3.22.5",
100
- "@tiptap/suggestion": "3.22.5",
62
+ "@office-open/core": "0.10.9",
63
+ "@office-open/docx": "0.10.9",
64
+ "@tiptap/core": "3.27.1",
65
+ "@tiptap/extension-blockquote": "3.27.1",
66
+ "@tiptap/extension-bold": "3.27.1",
67
+ "@tiptap/extension-bullet-list": "3.27.1",
68
+ "@tiptap/extension-code": "3.27.1",
69
+ "@tiptap/extension-code-block": "3.27.1",
70
+ "@tiptap/extension-code-block-lowlight": "3.27.1",
71
+ "@tiptap/extension-details": "3.27.1",
72
+ "@tiptap/extension-document": "3.27.1",
73
+ "@tiptap/extension-emoji": "3.27.1",
74
+ "@tiptap/extension-hard-break": "3.27.1",
75
+ "@tiptap/extension-heading": "3.27.1",
76
+ "@tiptap/extension-highlight": "3.27.1",
77
+ "@tiptap/extension-horizontal-rule": "3.27.1",
78
+ "@tiptap/extension-image": "3.27.1",
79
+ "@tiptap/extension-italic": "3.27.1",
80
+ "@tiptap/extension-link": "3.27.1",
81
+ "@tiptap/extension-list-item": "3.27.1",
82
+ "@tiptap/extension-mathematics": "3.27.1",
83
+ "@tiptap/extension-mention": "3.27.1",
84
+ "@tiptap/extension-ordered-list": "3.27.1",
85
+ "@tiptap/extension-paragraph": "3.27.1",
86
+ "@tiptap/extension-strike": "3.27.1",
87
+ "@tiptap/extension-subscript": "3.27.1",
88
+ "@tiptap/extension-superscript": "3.27.1",
89
+ "@tiptap/extension-table": "3.27.1",
90
+ "@tiptap/extension-task-item": "3.27.1",
91
+ "@tiptap/extension-task-list": "3.27.1",
92
+ "@tiptap/extension-text": "3.27.1",
93
+ "@tiptap/extension-text-align": "3.27.1",
94
+ "@tiptap/extension-text-style": "3.27.1",
95
+ "@tiptap/extension-underline": "3.27.1",
96
+ "@tiptap/markdown": "3.27.1",
97
+ "@tiptap/pm": "3.27.1",
98
+ "@tiptap/suggestion": "3.27.1",
101
99
  "image-meta": "0.2.2",
100
+ "linkedom": "0.18.12",
102
101
  "lowlight": "3.3.0"
103
102
  },
104
103
  "scripts": {
@@ -1,31 +0,0 @@
1
- import "./tiptap-D7pl4I5U.mjs";
2
- //#region src/extensions/blockquote.ts
3
- /**
4
- * Blockquote extension — owns the DOCX expression of a blockquote.
5
- *
6
- * DOCX has no blockquote element; the convention is a left indent plus a left
7
- * border on each contained paragraph. This module owns that signature; the
8
- * DocxManager walks the blockquote's child paragraphs and applies it to each.
9
- */
10
- /** Left indent (twips, ~0.5 inch) marking a blockquote. */
11
- const BLOCKQUOTE_INDENT_LEFT = 720;
12
- /** Left border marking a blockquote. */
13
- const BLOCKQUOTE_BORDER = {
14
- style: "single",
15
- size: 18,
16
- space: 12,
17
- color: "CCCCCC"
18
- };
19
- /** Apply the blockquote signature (left indent + left border) to paragraph opts. */
20
- function applyBlockquoteStyle(paraObj) {
21
- paraObj.indent = {
22
- ...paraObj.indent ?? {},
23
- left: 720
24
- };
25
- paraObj.border = {
26
- ...paraObj.border ?? {},
27
- left: BLOCKQUOTE_BORDER
28
- };
29
- }
30
- //#endregion
31
- export { BLOCKQUOTE_INDENT_LEFT as n, applyBlockquoteStyle as r, BLOCKQUOTE_BORDER as t };
@@ -1,23 +0,0 @@
1
- import { a as CodeBlockLowlight } from "./tiptap-D7pl4I5U.mjs";
2
- //#region src/extensions/code-block.ts
3
- /**
4
- * CodeBlock extension — CodeBlockLowlight with a DOCX renderDocx.
5
- *
6
- * DOCX has no dedicated code-block element. A code block maps to a single
7
- * paragraph styled "Code" with a monospace run font. Inline marks (syntax-
8
- * highlight tokens) and line breaks (`\n` → `<w:br/>`) are handled by
9
- * DocxManager's shared inline-content compilation; resolveCodeBlock reassembles
10
- * the text. This module owns only the paragraph-level style.
11
- *
12
- * `language` has no OOXML carrier and is intentionally dropped (known lossy).
13
- */
14
- /** codeBlock node → paragraph properties (style "Code" + monospace font). */
15
- function renderDocx(_node) {
16
- return {
17
- style: "Code",
18
- run: { font: "Consolas" }
19
- };
20
- }
21
- const CodeBlock = CodeBlockLowlight.extend({ renderDocx });
22
- //#endregion
23
- export { renderDocx as n, CodeBlock as t };