@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
@@ -1,2 +1,155 @@
1
- import { n as parseDocx, r as renderDocx, t as Table } from "../table-DrA12lxX.mjs";
1
+ import { Table as Table$1 } from "./tiptap.mjs";
2
+ import { alignmentFromElement, alignmentToCss, attrNative, bordersFromElement, renderBorderCSS, shadingFromElement, shadingToCss, twipToCss } from "./utils.mjs";
3
+ //#region src/extensions/table.ts
4
+ /**
5
+ * Table extension with nested office-open attrs.
6
+ *
7
+ * Attrs mirror TableOptions (width/float/layout/borders/alignment/margins/indent/
8
+ * cellSpacing/tableLook/columnWidths/etc.). DOCX round-trip is near-identity:
9
+ * renderDocx/parseDocx pass attrs through (omitting only `rows`, which DocxManager
10
+ * rebuilds from the row/cell nodes). CSS conversion happens only in renderHTML.
11
+ */
12
+ /** Structural key rebuilt by DocxManager (compileTableNode walks the row nodes). */
13
+ const SKIP_KEYS = new Set(["rows", "columnWidthsRevision"]);
14
+ function renderDocx(node) {
15
+ const attrs = node.attrs ?? {};
16
+ const opts = {};
17
+ for (const [key, value] of Object.entries(attrs)) {
18
+ if (SKIP_KEYS.has(key)) continue;
19
+ if (value !== null && value !== void 0) opts[key] = value;
20
+ }
21
+ return opts;
22
+ }
23
+ function parseDocx(opts) {
24
+ const attrs = {};
25
+ for (const [key, value] of Object.entries(opts)) {
26
+ if (SKIP_KEYS.has(key)) continue;
27
+ attrs[key] = value ?? null;
28
+ }
29
+ return attrs;
30
+ }
31
+ const Table = Table$1.extend({
32
+ addAttributes() {
33
+ return {
34
+ ...this.parent?.(),
35
+ width: attrNative(),
36
+ columnWidths: attrNative(),
37
+ indent: attrNative(),
38
+ margins: attrNative(),
39
+ float: attrNative(),
40
+ borders: {
41
+ default: null,
42
+ rendered: false,
43
+ parseHTML: (el) => bordersFromElement(el)
44
+ },
45
+ shading: {
46
+ default: null,
47
+ rendered: false,
48
+ parseHTML: (el) => shadingFromElement(el)
49
+ },
50
+ alignment: {
51
+ default: null,
52
+ rendered: false,
53
+ parseHTML: (el) => alignmentFromElement(el)
54
+ },
55
+ layout: {
56
+ default: null,
57
+ rendered: false,
58
+ parseHTML: (el) => el.style.tableLayout === "fixed" ? "fixed" : null
59
+ },
60
+ style: attrNative(),
61
+ visuallyRightToLeft: attrNative(),
62
+ tableLook: attrNative(),
63
+ cellSpacing: attrNative(),
64
+ styleRowBandSize: attrNative(),
65
+ styleColBandSize: attrNative(),
66
+ caption: attrNative(),
67
+ description: attrNative()
68
+ };
69
+ },
70
+ renderHTML({ node, HTMLAttributes }) {
71
+ const a = node.attrs;
72
+ const attrs = { ...HTMLAttributes };
73
+ const styles = [];
74
+ const align = alignmentToCss(a.alignment);
75
+ if (align === "center") styles.push("margin-left:auto", "margin-right:auto");
76
+ else if (align === "right") styles.push("margin-left:auto", "margin-right:0");
77
+ else if (align) styles.push("margin-left:0", "margin-right:auto");
78
+ if (a.layout === "fixed") styles.push("table-layout:fixed");
79
+ if (a.width && typeof a.width === "object") {
80
+ const w = a.width;
81
+ const numSize = typeof w.size === "string" ? parseFloat(w.size) : w.size;
82
+ if (w.type === "pct") {
83
+ if (typeof w.size === "string" && w.size.includes("%")) styles.push(`width:${w.size}`);
84
+ else if (!Number.isNaN(numSize)) styles.push(`width:${numSize / 50}%`);
85
+ } else if (w.type === "auto") styles.push("width:100%");
86
+ else if (numSize != null) {
87
+ const css = twipToCss(numSize);
88
+ if (css) styles.push(`width:${css}`);
89
+ }
90
+ } else styles.push("width:100%");
91
+ styles.push("max-width:100%");
92
+ if (a.indent && typeof a.indent === "object") {
93
+ const ind = a.indent;
94
+ if (ind.size != null) {
95
+ const css = twipToCss(ind.size);
96
+ if (css) styles.push(`margin-left:${css}`);
97
+ }
98
+ }
99
+ if (a.cellSpacing && typeof a.cellSpacing === "object") {
100
+ const cs = a.cellSpacing;
101
+ if (cs.value != null) {
102
+ const css = twipToCss(cs.value);
103
+ if (css) styles.push(`border-spacing:${css}`);
104
+ }
105
+ }
106
+ const bg = shadingToCss(a.shading);
107
+ if (bg) styles.push(`background-color:${bg}`);
108
+ if (a.borders && typeof a.borders === "object") {
109
+ const b = a.borders;
110
+ const sides = [
111
+ ["top", b.top],
112
+ ["bottom", b.bottom],
113
+ ["left", b.left],
114
+ ["right", b.right]
115
+ ];
116
+ for (const [side, border] of sides) {
117
+ const css = renderBorderCSS(border);
118
+ if (css) styles.push(`border-${side}:${css}`);
119
+ }
120
+ }
121
+ const firstRow = node.firstChild;
122
+ const cellPx = [];
123
+ if (firstRow) for (let i = 0; i < firstRow.childCount; i++) {
124
+ const cw = firstRow.child(i).attrs.colwidth;
125
+ if (Array.isArray(cw) && cw.length) for (const w of cw) cellPx.push(w || 0);
126
+ else cellPx.push(0);
127
+ }
128
+ const hasCellWidths = cellPx.some((w) => w > 0);
129
+ const tblGridPx = (a.columnWidths ?? []).map((w) => Math.round((w || 0) / 15));
130
+ const gridPx = tblGridPx.some((w) => w > 0) ? tblGridPx : hasCellWidths ? cellPx : tblGridPx;
131
+ if (styles.length > 0) attrs.style = styles.join(";");
132
+ if (gridPx.some((w) => w > 0)) {
133
+ const gridTotal = gridPx.reduce((sum, w) => sum + w, 0);
134
+ return [
135
+ "table",
136
+ attrs,
137
+ [
138
+ "colgroup",
139
+ {},
140
+ ...gridPx.map((w) => ["col", { style: `width:${gridTotal > 0 ? (w / gridTotal * 100).toFixed(2) : 0}%` }])
141
+ ],
142
+ ["tbody", 0]
143
+ ];
144
+ }
145
+ return [
146
+ "table",
147
+ attrs,
148
+ 0
149
+ ];
150
+ },
151
+ renderDocx,
152
+ parseDocx
153
+ });
154
+ //#endregion
2
155
  export { Table, parseDocx, renderDocx };
@@ -1,4 +1,4 @@
1
- import { N as TaskItem } from "../tiptap-TErPjuNJ.mjs";
1
+ import { A as TaskItem } from "../tiptap-pZsNPsvV.mjs";
2
2
 
3
3
  //#region src/extensions/task-item.d.ts
4
4
  /**
@@ -1,3 +1,37 @@
1
- import { N as TaskItem } from "../tiptap-D7pl4I5U.mjs";
2
- import { i as readCheckboxState, n as createTaskCheckbox, r as isTaskCheckbox, t as TASK_CHECKBOX_TAG } from "../task-item-BnlXGrIG.mjs";
1
+ import { TaskItem } from "./tiptap.mjs";
2
+ //#region src/extensions/task-item.ts
3
+ /**
4
+ * TaskItem extension — owns the DOCX expression of a task-list checkbox.
5
+ *
6
+ * DOCX has no native task list, but a clickable checkbox is reversible via an
7
+ * inline content-control SDT (w14:checkbox). Each task paragraph carries a
8
+ * leading checkbox SDT tagged "docen-task" so resolve can tell task items apart
9
+ * from ordinary paragraphs that happen to contain an SDT. The checked state
10
+ * round-trips through the SDT; DocxManager injects/strips the SDT at the
11
+ * paragraph boundary and rebuilds the taskList/taskItem tree.
12
+ */
13
+ /** SDT tag marking our task-item checkbox content control. */
14
+ const TASK_CHECKBOX_TAG = "docen-task";
15
+ /**
16
+ * Inline checkbox SDT (w14:checkbox) for a task item, as a ParagraphChild.
17
+ * Tagged so resolve can distinguish task items from ordinary SDT-bearing
18
+ * paragraphs.
19
+ */
20
+ function createTaskCheckbox(checked) {
21
+ return { sdt: { properties: {
22
+ tag: TASK_CHECKBOX_TAG,
23
+ checkbox: { checked }
24
+ } } };
25
+ }
26
+ /** True if an inline ParagraphChild is our task checkbox SDT. */
27
+ function isTaskCheckbox(child) {
28
+ if (typeof child !== "object" || child === null || !("sdt" in child)) return false;
29
+ return (child.sdt?.properties)?.tag === TASK_CHECKBOX_TAG;
30
+ }
31
+ /** Read the checked state of a task checkbox SDT child (false if not one). */
32
+ function readCheckboxState(child) {
33
+ if (!isTaskCheckbox(child)) return false;
34
+ return Boolean(child.sdt?.properties?.checkbox?.checked);
35
+ }
36
+ //#endregion
3
37
  export { TASK_CHECKBOX_TAG, TaskItem, createTaskCheckbox, isTaskCheckbox, readCheckboxState };
@@ -1,2 +1,146 @@
1
- import { n as parseDocx, r as renderDocx, t as TextStyle } from "../text-style-tMeBq5XQ.mjs";
1
+ import { TextStyle as TextStyle$1 } from "./tiptap.mjs";
2
+ import { attrNative, characterSpacingFromCss, characterSpacingToCss, normalizeColorToHex, resolveFontFamilyCss, shadingFromCss, shadingToCss, sizeFromCss, sizeToCss } from "./utils.mjs";
3
+ //#region src/extensions/text-style.ts
4
+ /**
5
+ * TextStyle mark with office-open attrs.
6
+ *
7
+ * Attrs mirror RunStylePropertiesOptions (bold/italic/strike/subScript/
8
+ * superScript handled by dedicated marks and therefore omitted). DOCX
9
+ * round-trip is near-identity: renderDocx/parseDocx pass attrs through;
10
+ * CSS conversion happens only in attribute-level renderHTML/parseHTML.
11
+ */
12
+ /** Structural/semantic keys expressed elsewhere (run children/text, style name). */
13
+ const SKIP_KEYS = new Set([
14
+ "children",
15
+ "text",
16
+ "style",
17
+ "break",
18
+ "bold",
19
+ "italic",
20
+ "strike",
21
+ "doubleStrike",
22
+ "subScript",
23
+ "superScript"
24
+ ]);
25
+ function renderDocx(attrs) {
26
+ const opts = {};
27
+ for (const [key, value] of Object.entries(attrs)) {
28
+ if (SKIP_KEYS.has(key)) continue;
29
+ if (value === null || value === void 0) continue;
30
+ if (key === "styleId") {
31
+ opts.style = value;
32
+ continue;
33
+ }
34
+ opts[key] = value;
35
+ }
36
+ return opts;
37
+ }
38
+ function parseDocx(opts) {
39
+ const resolved = typeof opts === "string" ? { text: opts } : opts;
40
+ const attrs = {};
41
+ if (resolved.style) attrs.styleId = resolved.style;
42
+ for (const [key, value] of Object.entries(resolved)) {
43
+ if (SKIP_KEYS.has(key)) continue;
44
+ attrs[key] = value ?? null;
45
+ }
46
+ return attrs;
47
+ }
48
+ const TextStyle = TextStyle$1.extend({
49
+ addAttributes() {
50
+ return {
51
+ ...this.parent?.(),
52
+ styleId: {
53
+ default: null,
54
+ parseHTML: (element) => {
55
+ const m = (element.getAttribute("class") || "").match(/(?:^|\s)docx-char-(\S+)/);
56
+ return m ? m[1] : null;
57
+ },
58
+ renderHTML: (attributes) => {
59
+ const id = attributes.styleId;
60
+ return id ? { class: `docx-char-${id}` } : {};
61
+ }
62
+ },
63
+ color: {
64
+ default: null,
65
+ parseHTML: (element) => normalizeColorToHex(element.style.color || void 0) ?? null,
66
+ renderHTML: (attributes) => {
67
+ if (attributes.color === "auto") return {};
68
+ const hex = normalizeColorToHex(attributes.color);
69
+ return hex ? { style: `color:${hex}` } : {};
70
+ }
71
+ },
72
+ characterSpacing: {
73
+ default: null,
74
+ parseHTML: (element) => characterSpacingFromCss(element.style.letterSpacing || null),
75
+ renderHTML: (attributes) => {
76
+ const css = characterSpacingToCss(attributes.characterSpacing);
77
+ return css ? { style: `letter-spacing:${css}` } : {};
78
+ }
79
+ },
80
+ font: {
81
+ default: null,
82
+ parseHTML: (element) => element.style.fontFamily || null,
83
+ renderHTML: (attributes) => {
84
+ const name = resolveFontFamilyCss(attributes.font);
85
+ return name ? { style: `font-family:${name}` } : {};
86
+ }
87
+ },
88
+ rightToLeft: {
89
+ default: null,
90
+ parseHTML: (element) => element.dir === "rtl" ? true : null,
91
+ renderHTML: (attributes) => attributes.rightToLeft ? { style: "direction:rtl" } : {}
92
+ },
93
+ size: {
94
+ default: null,
95
+ parseHTML: (element) => sizeFromCss(element.style.fontSize),
96
+ renderHTML: (attributes) => {
97
+ const css = sizeToCss(attributes.size);
98
+ return css ? { style: `font-size:${css}` } : {};
99
+ }
100
+ },
101
+ shading: {
102
+ default: null,
103
+ parseHTML: (element) => shadingFromCss(element.style.backgroundColor),
104
+ renderHTML: (attributes) => {
105
+ const css = shadingToCss(attributes.shading);
106
+ return css ? { style: `background-color:${css};color:contrast-color(${css})` } : {};
107
+ }
108
+ },
109
+ underline: attrNative(),
110
+ emphasisMark: attrNative(),
111
+ highlight: attrNative(),
112
+ smallCaps: attrNative(),
113
+ allCaps: attrNative(),
114
+ kern: attrNative(),
115
+ position: attrNative(),
116
+ effect: attrNative(),
117
+ noProof: attrNative(),
118
+ sizeComplexScript: attrNative(),
119
+ highlightComplexScript: attrNative(),
120
+ boldComplexScript: attrNative(),
121
+ italicComplexScript: attrNative(),
122
+ doubleStrike: attrNative(),
123
+ emboss: attrNative(),
124
+ imprint: attrNative(),
125
+ revision: attrNative(),
126
+ language: attrNative(),
127
+ border: attrNative(),
128
+ snapToGrid: attrNative(),
129
+ vanish: attrNative(),
130
+ specVanish: attrNative(),
131
+ scale: attrNative(),
132
+ math: attrNative(),
133
+ outline: attrNative(),
134
+ shadow: attrNative(),
135
+ webHidden: attrNative(),
136
+ fitText: attrNative(),
137
+ complexScript: attrNative(),
138
+ eastAsianLayout: attrNative(),
139
+ contentPartRId: attrNative()
140
+ };
141
+ },
142
+ renderDocx,
143
+ parseDocx
144
+ });
145
+ //#endregion
2
146
  export { TextStyle, parseDocx, renderDocx };
@@ -1,2 +1,2 @@
1
- import { A as TableCell, B as UndoRedo, C as Mention, D as Subscript, E as Strike, F as Text, I as TextAlign, L as TextStyle, M as TableRow, N as TaskItem, O as Superscript, P as TaskList, R as TrailingNode, S as Mathematics, T as Paragraph, _ as Image, a as CodeBlockLowlight, b as ListItem, c as DetailsSummary, d as Emoji, f as Gapcursor, g as HorizontalRule, h as Highlight, i as Code, j as TableHeader, k as Table, l as Document, m as Heading, 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
- 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, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TrailingNode, Underline, UndoRedo };
1
+ import { A as TaskItem, C as Strike, D as TableCell, E as Table, F as Underline, M as Text, N as TextAlign, O as TableHeader, P as TextStyle, S as Paragraph, T as Superscript, _ as Link, a as CodeBlockLowlight, b as Mention, c as DetailsSummary, d as HardBreak, f as Heading, g as Italic, h as Image, i as Code, j as TaskList, k as TableRow, l as Document, 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
+ export { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Document, Emoji, HardBreak, Heading, Highlight, HorizontalRule, Image, Italic, Link, ListItem, Mathematics, Mention, OrderedList, Paragraph, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, Underline };
@@ -1,2 +1,31 @@
1
- import { A as TableCell, B as UndoRedo, C as Mention, D as Subscript, E as Strike, F as Text, I as TextAlign, L as TextStyle, M as TableRow, N as TaskItem, O as Superscript, P as TaskList, R as TrailingNode, S as Mathematics, T as Paragraph, _ as Image, a as CodeBlockLowlight, b as ListItem, c as DetailsSummary, d as Emoji, f as Gapcursor, g as HorizontalRule, h as Highlight, i as Code, j as TableHeader, k as Table, l as Document, m as Heading, 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
- 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, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, TrailingNode, Underline, UndoRedo };
1
+ import { Document } from "@tiptap/extension-document";
2
+ import { Text } from "@tiptap/extension-text";
3
+ import { Paragraph } from "@tiptap/extension-paragraph";
4
+ import { Heading } from "@tiptap/extension-heading";
5
+ import { Blockquote } from "@tiptap/extension-blockquote";
6
+ import { HorizontalRule } from "@tiptap/extension-horizontal-rule";
7
+ import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
8
+ import { BulletList } from "@tiptap/extension-bullet-list";
9
+ import { OrderedList } from "@tiptap/extension-ordered-list";
10
+ import { ListItem } from "@tiptap/extension-list-item";
11
+ import { TaskList } from "@tiptap/extension-task-list";
12
+ import { TaskItem } from "@tiptap/extension-task-item";
13
+ import { Table, TableCell, TableHeader, TableRow } from "@tiptap/extension-table";
14
+ import { Image } from "@tiptap/extension-image";
15
+ import { HardBreak } from "@tiptap/extension-hard-break";
16
+ import { Details, DetailsContent, DetailsSummary } from "@tiptap/extension-details";
17
+ import { Emoji } from "@tiptap/extension-emoji";
18
+ import { Mention } from "@tiptap/extension-mention";
19
+ import { Mathematics } from "@tiptap/extension-mathematics";
20
+ import { Bold } from "@tiptap/extension-bold";
21
+ import { Italic } from "@tiptap/extension-italic";
22
+ import { Underline } from "@tiptap/extension-underline";
23
+ import { Strike } from "@tiptap/extension-strike";
24
+ import { Code } from "@tiptap/extension-code";
25
+ import { Link } from "@tiptap/extension-link";
26
+ import { Highlight } from "@tiptap/extension-highlight";
27
+ import { Subscript } from "@tiptap/extension-subscript";
28
+ import { Superscript } from "@tiptap/extension-superscript";
29
+ import { TextStyle } from "@tiptap/extension-text-style";
30
+ import { TextAlign } from "@tiptap/extension-text-align";
31
+ export { Blockquote, Bold, BulletList, Code, CodeBlockLowlight, Details, DetailsContent, DetailsSummary, Document, Emoji, HardBreak, Heading, Highlight, HorizontalRule, Image, Italic, Link, ListItem, Mathematics, Mention, OrderedList, Paragraph, Strike, Subscript, Superscript, Table, TableCell, TableHeader, TableRow, TaskItem, TaskList, Text, TextAlign, TextStyle, Underline };
@@ -0,0 +1,2 @@
1
+ import { h as TocField } from "../core-DRaLI8nd.mjs";
2
+ export { TocField };
@@ -0,0 +1,2 @@
1
+ import { m as TocField } from "../core-B8ba_FNi.mjs";
2
+ export { TocField };
@@ -1,62 +1,2 @@
1
- import { BorderOptions, BordersOptions, IndentAttributesProperties, ShadingAttributesProperties, SpacingProperties } from "@office-open/docx";
2
-
3
- //#region src/extensions/utils.d.ts
4
- /** Normalize a CSS color value to hex (e.g., "red" → "#FF0000", "#ff0000" → "#FF0000").
5
- * Accepts a string (CSS name/hex or bare OOXML hex), or an OOXML ColorOptions
6
- * object ({ val, themeColor, themeTint, themeShade }) — the object form
7
- * resolves to its val (the RGB fallback Word stores alongside themeColor) for
8
- * CSS rendering. The themeColor/tint/shade are preserved verbatim in the attrs
9
- * and round-trip back to the DOCX (see text-style/paragraph parseDocx), so
10
- * theme semantics survive even though only val is rendered here. A pure theme
11
- * reference with no val (rare — Word usually stores both) would need theme.xml
12
- * to resolve and is left unset. */
13
- declare function normalizeColorToHex(color: unknown): string | undefined;
14
- /** Resolve a font value (string or OOXML rFonts { ascii, eastAsia, hAnsi, cs }) to a CSS family name. */
15
- declare function resolveFontName(font: unknown): string | null;
16
- /** CSS value (e.g., "18pt") → twip number. 1 pt = 20 twips, 1 px = 15 twips (96 DPI). */
17
- declare function cssToTwip(value: string | undefined): number | undefined;
18
- /** Twip value → CSS string (e.g., 360 → "18pt"). */
19
- declare function twipToCss(value: number | string | undefined): string | null;
20
- /** OOXML alignment → CSS text-align. */
21
- declare function alignmentToCss(alignment: string | null | undefined): string | null;
22
- /** CSS text-align → OOXML alignment. */
23
- declare function alignmentFromCss(css: string | null | undefined): string | null;
24
- /** Shading.fill → CSS background-color hex. */
25
- declare function shadingToCss(shading: ShadingAttributesProperties | null | undefined): string | null;
26
- /** CSS background-color → ShadingAttributesProperties (fill normalized to hex). */
27
- declare function shadingFromCss(css: string | null | undefined): ShadingAttributesProperties | null;
28
- declare function lineSpacingToCss(spacing: SpacingProperties | null | undefined): string | null;
29
- declare function sizeToCss(size: number | null | undefined): string | null;
30
- declare function sizeFromCss(css: string | null | undefined): number | null;
31
- declare function characterSpacingToCss(spacing: number | null | undefined): string | null;
32
- declare function characterSpacingFromCss(css: string | null | undefined): number | null;
33
- /** Render a BorderOptions to CSS string. OOXML border.size is in eighths of a point. */
34
- declare function renderBorderCSS(border: BorderOptions): string | null;
35
- /**
36
- * Compute all paragraph-level CSS styles from nested attrs.
37
- * Shared by Paragraph and Heading extensions for node-level renderHTML.
38
- * Attrs store office-open native values; mappers here convert to CSS.
39
- */
40
- declare function renderParagraphStyles(attrs: Record<string, unknown>): string[];
41
- /**
42
- * Compute run-level CSS (font/size/color/weight/…) from office-open run attrs.
43
- * Shared by text-style marks and the styles→CSS generator (stylesToCss).
44
- */
45
- declare function renderRunStyles(attrs: Record<string, unknown>): string[];
46
- /**
47
- * Compute table cell CSS styles from nested attrs.
48
- * Shared by TableCell and TableHeader extensions.
49
- */
50
- declare function renderTableCellStyles(attrs: Record<string, unknown>): string[];
51
- /** Parse text-align → OOXML alignment. */
52
- declare function alignmentFromElement(el: HTMLElement): string | null;
53
- /** Parse margin-left/right + text-indent → OOXML indent (twips). */
54
- declare function indentFromElement(el: HTMLElement): IndentAttributesProperties | null;
55
- /** Parse margin-top/bottom + line-height → OOXML spacing (twips). */
56
- declare function spacingFromElement(el: HTMLElement): SpacingProperties | null;
57
- /** Parse border-* → OOXML BordersOptions. */
58
- declare function bordersFromElement(el: HTMLElement): BordersOptions | null;
59
- /** Parse background-color → OOXML shading. */
60
- declare function shadingFromElement(el: HTMLElement): ShadingAttributesProperties | null;
61
- //#endregion
62
- export { alignmentFromCss, alignmentFromElement, alignmentToCss, bordersFromElement, characterSpacingFromCss, characterSpacingToCss, cssToTwip, indentFromElement, lineSpacingToCss, normalizeColorToHex, renderBorderCSS, renderParagraphStyles, renderRunStyles, renderTableCellStyles, resolveFontName, shadingFromCss, shadingFromElement, shadingToCss, sizeFromCss, sizeToCss, spacingFromElement, twipToCss };
1
+ import { A as twipsToMm, C as shadingFromCss, D as sizeToCss, E as sizeFromCss, O as spacingFromElement, S as sectionMarginCss, T as shadingToCss, _ as renderTableCellStyles, a as bordersFromElement, b as resolvePageSize, c as cssToTwip, d as indentFromElement, f as lineSpacingToCss, g as renderRunStyles, h as renderParagraphStyles, i as attrNative, k as twipToCss, l as floatAnchorScope, m as renderBorderCSS, n as alignmentFromElement, o as characterSpacingFromCss, p as normalizeColorToHex, r as alignmentToCss, s as characterSpacingToCss, t as alignmentFromCss, u as floatingToStyles, v as resolveFontFamilyCss, w as shadingFromElement, x as sectionLinePitchCss, y as resolveFontName } from "../utils-BJwDQts7.mjs";
2
+ export { alignmentFromCss, alignmentFromElement, alignmentToCss, attrNative, bordersFromElement, characterSpacingFromCss, characterSpacingToCss, cssToTwip, floatAnchorScope, floatingToStyles, indentFromElement, lineSpacingToCss, normalizeColorToHex, renderBorderCSS, renderParagraphStyles, renderRunStyles, renderTableCellStyles, resolveFontFamilyCss, resolveFontName, resolvePageSize, sectionLinePitchCss, sectionMarginCss, shadingFromCss, shadingFromElement, shadingToCss, sizeFromCss, sizeToCss, spacingFromElement, twipToCss, twipsToMm };