@docen/docx 0.3.0

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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +156 -0
  3. package/dist/converters/docx.d.mts +110 -0
  4. package/dist/converters/docx.mjs +624 -0
  5. package/dist/converters/html.d.mts +14 -0
  6. package/dist/converters/html.mjs +18 -0
  7. package/dist/converters/markdown.d.mts +13 -0
  8. package/dist/converters/markdown.mjs +18 -0
  9. package/dist/converters/patch.d.mts +53 -0
  10. package/dist/converters/patch.mjs +37 -0
  11. package/dist/converters/prepare.d.mts +51 -0
  12. package/dist/converters/prepare.mjs +76 -0
  13. package/dist/core-CFIQVRfx.mjs +88 -0
  14. package/dist/core-omBKMRtl.d.mts +34 -0
  15. package/dist/core.d.mts +2 -0
  16. package/dist/core.mjs +2 -0
  17. package/dist/editor.d.mts +21 -0
  18. package/dist/editor.mjs +20 -0
  19. package/dist/extensions/extensions.d.mts +12 -0
  20. package/dist/extensions/extensions.mjs +12 -0
  21. package/dist/extensions/heading.d.mts +2 -0
  22. package/dist/extensions/heading.mjs +145 -0
  23. package/dist/extensions/image.d.mts +2 -0
  24. package/dist/extensions/image.mjs +201 -0
  25. package/dist/extensions/index.d.mts +2 -0
  26. package/dist/extensions/index.mjs +2 -0
  27. package/dist/extensions/paragraph.d.mts +2 -0
  28. package/dist/extensions/paragraph.mjs +116 -0
  29. package/dist/extensions/strike.d.mts +2 -0
  30. package/dist/extensions/strike.mjs +50 -0
  31. package/dist/extensions/table-cell.d.mts +2 -0
  32. package/dist/extensions/table-cell.mjs +112 -0
  33. package/dist/extensions/table-header.d.mts +2 -0
  34. package/dist/extensions/table-header.mjs +112 -0
  35. package/dist/extensions/table-row.d.mts +2 -0
  36. package/dist/extensions/table-row.mjs +84 -0
  37. package/dist/extensions/table.d.mts +2 -0
  38. package/dist/extensions/table.mjs +134 -0
  39. package/dist/extensions/text-style.d.mts +2 -0
  40. package/dist/extensions/text-style.mjs +134 -0
  41. package/dist/extensions/tiptap.d.mts +2 -0
  42. package/dist/extensions/tiptap.mjs +33 -0
  43. package/dist/extensions/types.d.mts +30 -0
  44. package/dist/extensions/utils.d.mts +49 -0
  45. package/dist/extensions/utils.mjs +289 -0
  46. package/dist/heading-BvqBD2zX.d.mts +8 -0
  47. package/dist/image-Ge1y6uam.d.mts +47 -0
  48. package/dist/index.d.mts +213 -0
  49. package/dist/index.mjs +8 -0
  50. package/dist/paragraph-fhEXtAN2.d.mts +16 -0
  51. package/dist/strike-BgWGvjKr.d.mts +33 -0
  52. package/dist/table-BFkfeRp9.d.mts +9 -0
  53. package/dist/table-cell-D_FV4D2h.d.mts +8 -0
  54. package/dist/table-header-KGQ2aEkP.d.mts +8 -0
  55. package/dist/table-row-kgzYkZlW.d.mts +9 -0
  56. package/dist/text-style-BHdtXkMb.d.mts +8 -0
  57. package/dist/tiptap-TErPjuNJ.d.mts +33 -0
  58. package/package.json +106 -0
@@ -0,0 +1,84 @@
1
+ import { TableRow as TableRow$1 } from "./tiptap.mjs";
2
+ import { cssToTwip } from "./utils.mjs";
3
+ //#region src/extensions/table-row.ts
4
+ /**
5
+ * Table row extension with nested office-open attrs.
6
+ *
7
+ * Attrs mirror TableRowPropertiesOptionsBase (cantSplit/tableHeader/hidden as
8
+ * booleans; height as a nested { value, rule } object; cellSpacing as a native
9
+ * value; widthBefore/widthAfter as TableWidthProperties; etc.). DOCX round-trip
10
+ * is near-identity: renderDocx/parseDocx pass attrs through (omitting the
11
+ * `cells` structural key that DocxManager owns). CSS conversion happens only
12
+ * in renderHTML.
13
+ */
14
+ /** Structural keys filled by DocxManager (compileTableNode). */
15
+ const SKIP_KEYS = new Set(["cells"]);
16
+ function renderDocx(node) {
17
+ const attrs = node.attrs ?? {};
18
+ const opts = {};
19
+ for (const [key, value] of Object.entries(attrs)) {
20
+ if (SKIP_KEYS.has(key)) continue;
21
+ if (value !== null && value !== void 0) opts[key] = value;
22
+ }
23
+ return opts;
24
+ }
25
+ function parseDocx(opts) {
26
+ const attrs = {};
27
+ for (const [key, value] of Object.entries(opts)) {
28
+ if (SKIP_KEYS.has(key)) continue;
29
+ attrs[key] = value ?? null;
30
+ }
31
+ return attrs;
32
+ }
33
+ const attrNative = () => ({
34
+ default: null,
35
+ parseHTML: () => null,
36
+ rendered: false
37
+ });
38
+ const TableRow = TableRow$1.extend({
39
+ addAttributes() {
40
+ return {
41
+ ...this.parent?.(),
42
+ height: {
43
+ default: null,
44
+ rendered: false,
45
+ parseHTML: (el) => {
46
+ const twips = cssToTwip(el.style.height || el.getAttribute("height") || "");
47
+ return twips != null ? {
48
+ value: twips,
49
+ rule: "atLeast"
50
+ } : null;
51
+ }
52
+ },
53
+ cantSplit: attrNative(),
54
+ tableHeader: attrNative(),
55
+ hidden: attrNative(),
56
+ divId: attrNative(),
57
+ gridBefore: attrNative(),
58
+ gridAfter: attrNative(),
59
+ rowAlignment: attrNative(),
60
+ cnfStyle: attrNative(),
61
+ cellSpacing: attrNative(),
62
+ widthBefore: attrNative(),
63
+ widthAfter: attrNative()
64
+ };
65
+ },
66
+ renderHTML({ node, HTMLAttributes }) {
67
+ const attrs = { ...HTMLAttributes };
68
+ const styles = [];
69
+ if (node.attrs.height && typeof node.attrs.height === "object") {
70
+ const h = node.attrs.height;
71
+ if (h.value != null) styles.push(`height:${h.value / 20}pt`);
72
+ }
73
+ if (styles.length > 0) attrs.style = styles.join(";");
74
+ return [
75
+ "tr",
76
+ attrs,
77
+ 0
78
+ ];
79
+ },
80
+ renderDocx,
81
+ parseDocx
82
+ });
83
+ //#endregion
84
+ export { TableRow, parseDocx, renderDocx };
@@ -0,0 +1,2 @@
1
+ import { n as parseDocx, r as renderDocx, t as Table } from "../table-BFkfeRp9.mjs";
2
+ export { Table, parseDocx, renderDocx };
@@ -0,0 +1,134 @@
1
+ import { Table as Table$1 } from "./tiptap.mjs";
2
+ import { alignmentFromElement, alignmentToCss, 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 attrNative = () => ({
32
+ default: null,
33
+ parseHTML: () => null,
34
+ rendered: false
35
+ });
36
+ const Table = Table$1.extend({
37
+ addAttributes() {
38
+ return {
39
+ ...this.parent?.(),
40
+ width: attrNative(),
41
+ columnWidths: attrNative(),
42
+ indent: attrNative(),
43
+ margins: attrNative(),
44
+ float: attrNative(),
45
+ borders: {
46
+ default: null,
47
+ rendered: false,
48
+ parseHTML: (el) => bordersFromElement(el)
49
+ },
50
+ shading: {
51
+ default: null,
52
+ rendered: false,
53
+ parseHTML: (el) => shadingFromElement(el)
54
+ },
55
+ alignment: {
56
+ default: null,
57
+ rendered: false,
58
+ parseHTML: (el) => alignmentFromElement(el)
59
+ },
60
+ layout: {
61
+ default: null,
62
+ rendered: false,
63
+ parseHTML: (el) => el.style.tableLayout === "fixed" ? "fixed" : null
64
+ },
65
+ style: attrNative(),
66
+ visuallyRightToLeft: attrNative(),
67
+ tableLook: attrNative(),
68
+ cellSpacing: attrNative(),
69
+ styleRowBandSize: attrNative(),
70
+ styleColBandSize: attrNative(),
71
+ caption: attrNative(),
72
+ description: attrNative()
73
+ };
74
+ },
75
+ renderHTML({ node, HTMLAttributes }) {
76
+ const a = node.attrs;
77
+ const attrs = { ...HTMLAttributes };
78
+ const styles = [];
79
+ const align = alignmentToCss(a.alignment);
80
+ if (align === "center") styles.push("margin-left:auto", "margin-right:auto");
81
+ else if (align === "right") styles.push("margin-left:auto", "margin-right:0");
82
+ else if (align) styles.push("margin-left:0", "margin-right:auto");
83
+ if (a.layout === "fixed") styles.push("table-layout:fixed");
84
+ if (a.width && typeof a.width === "object") {
85
+ const w = a.width;
86
+ const numSize = typeof w.size === "string" ? parseFloat(w.size) : w.size;
87
+ if (w.type === "pct") {
88
+ if (!Number.isNaN(numSize)) styles.push(`width:${numSize / 50}%`);
89
+ } else if (numSize != null) {
90
+ const css = twipToCss(numSize);
91
+ if (css) styles.push(`width:${css}`);
92
+ }
93
+ }
94
+ if (a.indent && typeof a.indent === "object") {
95
+ const ind = a.indent;
96
+ if (ind.size != null) {
97
+ const css = twipToCss(ind.size);
98
+ if (css) styles.push(`margin-left:${css}`);
99
+ }
100
+ }
101
+ if (a.cellSpacing && typeof a.cellSpacing === "object") {
102
+ const cs = a.cellSpacing;
103
+ if (cs.value != null) {
104
+ const css = twipToCss(cs.value);
105
+ if (css) styles.push(`border-spacing:${css}`);
106
+ }
107
+ }
108
+ const bg = shadingToCss(a.shading);
109
+ if (bg) styles.push(`background-color:${bg}`);
110
+ if (a.borders && typeof a.borders === "object") {
111
+ const b = a.borders;
112
+ const sides = [
113
+ ["top", b.top],
114
+ ["bottom", b.bottom],
115
+ ["left", b.left],
116
+ ["right", b.right]
117
+ ];
118
+ for (const [side, border] of sides) {
119
+ const css = renderBorderCSS(border);
120
+ if (css) styles.push(`border-${side}:${css}`);
121
+ }
122
+ }
123
+ if (styles.length > 0) attrs.style = styles.join(";");
124
+ return [
125
+ "table",
126
+ attrs,
127
+ 0
128
+ ];
129
+ },
130
+ renderDocx,
131
+ parseDocx
132
+ });
133
+ //#endregion
134
+ export { Table, parseDocx, renderDocx };
@@ -0,0 +1,2 @@
1
+ import { n as parseDocx, r as renderDocx, t as TextStyle } from "../text-style-BHdtXkMb.mjs";
2
+ export { TextStyle, parseDocx, renderDocx };
@@ -0,0 +1,134 @@
1
+ import { TextStyle as TextStyle$1 } from "./tiptap.mjs";
2
+ import { characterSpacingFromCss, characterSpacingToCss, normalizeColorToHex, resolveFontName, 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
+ opts[key] = value;
31
+ }
32
+ return opts;
33
+ }
34
+ function parseDocx(opts) {
35
+ const resolved = typeof opts === "string" ? { text: opts } : opts;
36
+ const attrs = {};
37
+ for (const [key, value] of Object.entries(resolved)) {
38
+ if (SKIP_KEYS.has(key)) continue;
39
+ attrs[key] = value ?? null;
40
+ }
41
+ return attrs;
42
+ }
43
+ const attrNative = () => ({
44
+ default: null,
45
+ parseHTML: () => null,
46
+ rendered: false
47
+ });
48
+ const TextStyle = TextStyle$1.extend({
49
+ addAttributes() {
50
+ return {
51
+ ...this.parent?.(),
52
+ color: {
53
+ default: null,
54
+ parseHTML: (element) => normalizeColorToHex(element.style.color || void 0) ?? null,
55
+ renderHTML: (attributes) => {
56
+ const hex = normalizeColorToHex(attributes.color);
57
+ return hex ? { style: `color:${hex}` } : {};
58
+ }
59
+ },
60
+ characterSpacing: {
61
+ default: null,
62
+ parseHTML: (element) => characterSpacingFromCss(element.style.letterSpacing || null),
63
+ renderHTML: (attributes) => {
64
+ const css = characterSpacingToCss(attributes.characterSpacing);
65
+ return css ? { style: `letter-spacing:${css}` } : {};
66
+ }
67
+ },
68
+ font: {
69
+ default: null,
70
+ parseHTML: (element) => element.style.fontFamily || null,
71
+ renderHTML: (attributes) => {
72
+ const name = resolveFontName(attributes.font);
73
+ return name ? { style: `font-family:${name}` } : {};
74
+ }
75
+ },
76
+ rightToLeft: {
77
+ default: null,
78
+ parseHTML: (element) => element.dir === "rtl" ? true : null,
79
+ renderHTML: (attributes) => attributes.rightToLeft ? { style: "direction:rtl" } : {}
80
+ },
81
+ size: {
82
+ default: null,
83
+ parseHTML: (element) => sizeFromCss(element.style.fontSize),
84
+ renderHTML: (attributes) => {
85
+ const css = sizeToCss(attributes.size);
86
+ return css ? { style: `font-size:${css}` } : {};
87
+ }
88
+ },
89
+ shading: {
90
+ default: null,
91
+ parseHTML: (element) => shadingFromCss(element.style.backgroundColor),
92
+ renderHTML: (attributes) => {
93
+ const css = shadingToCss(attributes.shading);
94
+ return css ? { style: `background-color:${css}` } : {};
95
+ }
96
+ },
97
+ underline: attrNative(),
98
+ emphasisMark: attrNative(),
99
+ highlight: attrNative(),
100
+ smallCaps: attrNative(),
101
+ allCaps: attrNative(),
102
+ kern: attrNative(),
103
+ position: attrNative(),
104
+ effect: attrNative(),
105
+ noProof: attrNative(),
106
+ sizeComplexScript: attrNative(),
107
+ highlightComplexScript: attrNative(),
108
+ boldComplexScript: attrNative(),
109
+ italicComplexScript: attrNative(),
110
+ doubleStrike: attrNative(),
111
+ emboss: attrNative(),
112
+ imprint: attrNative(),
113
+ revision: attrNative(),
114
+ language: attrNative(),
115
+ border: attrNative(),
116
+ snapToGrid: attrNative(),
117
+ vanish: attrNative(),
118
+ specVanish: attrNative(),
119
+ scale: attrNative(),
120
+ math: attrNative(),
121
+ outline: attrNative(),
122
+ shadow: attrNative(),
123
+ webHidden: attrNative(),
124
+ fitText: attrNative(),
125
+ complexScript: attrNative(),
126
+ eastAsianLayout: attrNative(),
127
+ contentPartRId: attrNative()
128
+ };
129
+ },
130
+ renderDocx,
131
+ parseDocx
132
+ });
133
+ //#endregion
134
+ export { TextStyle, parseDocx, renderDocx };
@@ -0,0 +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 };
@@ -0,0 +1,33 @@
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
+ import { Dropcursor, Gapcursor, TrailingNode, UndoRedo } from "@tiptap/extensions";
32
+ import { ListKeymap } from "@tiptap/extension-list";
33
+ 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 };
@@ -0,0 +1,30 @@
1
+ import { JSONContent } from "@tiptap/core";
2
+ import { RunOptions } from "@office-open/docx";
3
+
4
+ //#region src/extensions/types.d.ts
5
+ declare module "@tiptap/core" {
6
+ interface NodeConfig<Options, Storage> {
7
+ /**
8
+ * DOCX serialization: Tiptap JSON node → DOCX opts.
9
+ * Each node extension defines this to convert its attrs to DOCX properties.
10
+ */
11
+ renderDocx?: (node: JSONContent) => Record<string, unknown>;
12
+ /**
13
+ * DOCX deserialization: DOCX opts → Tiptap JSON attrs.
14
+ * Each node extension defines this to convert DOCX properties back to attrs.
15
+ */
16
+ parseDocx?: (opts: Record<string, unknown>) => Record<string, unknown>;
17
+ }
18
+ interface MarkConfig<Options, Storage> {
19
+ /**
20
+ * DOCX serialization: mark attrs → RunOptions properties.
21
+ * Each mark extension defines this to contribute run-level properties.
22
+ */
23
+ renderDocx?: (attrs: Record<string, unknown>) => Partial<RunOptions>;
24
+ /**
25
+ * DOCX deserialization: RunOptions → mark attrs.
26
+ * Each mark extension defines this to extract its attrs from run properties.
27
+ */
28
+ parseDocx?: (opts: RunOptions) => Record<string, unknown>;
29
+ }
30
+ }
@@ -0,0 +1,49 @@
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
+ declare function normalizeColorToHex(color: string | undefined): string | undefined;
6
+ /** Resolve a font value (string or OOXML rFonts { ascii, eastAsia, hAnsi, cs }) to a CSS family name. */
7
+ declare function resolveFontName(font: unknown): string | null;
8
+ /** CSS value (e.g., "18pt") → twip number. 1 pt = 20 twips, 1 px = 15 twips (96 DPI). */
9
+ declare function cssToTwip(value: string | undefined): number | undefined;
10
+ /** Twip value → CSS string (e.g., 360 → "18pt"). */
11
+ declare function twipToCss(value: number | string | undefined): string | null;
12
+ /** OOXML alignment → CSS text-align. */
13
+ declare function alignmentToCss(alignment: string | null | undefined): string | null;
14
+ /** CSS text-align → OOXML alignment. */
15
+ declare function alignmentFromCss(css: string | null | undefined): string | null;
16
+ /** Shading.fill → CSS background-color hex. */
17
+ declare function shadingToCss(shading: ShadingAttributesProperties | null | undefined): string | null;
18
+ /** CSS background-color → ShadingAttributesProperties (fill normalized to hex). */
19
+ declare function shadingFromCss(css: string | null | undefined): ShadingAttributesProperties | null;
20
+ declare function lineSpacingToCss(spacing: SpacingProperties | null | undefined): string | null;
21
+ declare function sizeToCss(size: number | null | undefined): string | null;
22
+ declare function sizeFromCss(css: string | null | undefined): number | null;
23
+ declare function characterSpacingToCss(spacing: number | null | undefined): string | null;
24
+ declare function characterSpacingFromCss(css: string | null | undefined): number | null;
25
+ /** Render a BorderOptions to CSS string. OOXML border.size is in eighths of a point. */
26
+ declare function renderBorderCSS(border: BorderOptions): string | null;
27
+ /**
28
+ * Compute all paragraph-level CSS styles from nested attrs.
29
+ * Shared by Paragraph and Heading extensions for node-level renderHTML.
30
+ * Attrs store office-open native values; mappers here convert to CSS.
31
+ */
32
+ declare function renderParagraphStyles(attrs: Record<string, unknown>): string[];
33
+ /**
34
+ * Compute table cell CSS styles from nested attrs.
35
+ * Shared by TableCell and TableHeader extensions.
36
+ */
37
+ declare function renderTableCellStyles(attrs: Record<string, unknown>): string[];
38
+ /** Parse text-align → OOXML alignment. */
39
+ declare function alignmentFromElement(el: HTMLElement): string | null;
40
+ /** Parse margin-left/right + text-indent → OOXML indent (twips). */
41
+ declare function indentFromElement(el: HTMLElement): IndentAttributesProperties | null;
42
+ /** Parse margin-top/bottom + line-height → OOXML spacing (twips). */
43
+ declare function spacingFromElement(el: HTMLElement): SpacingProperties | null;
44
+ /** Parse border-* → OOXML BordersOptions. */
45
+ declare function bordersFromElement(el: HTMLElement): BordersOptions | null;
46
+ /** Parse background-color → OOXML shading. */
47
+ declare function shadingFromElement(el: HTMLElement): ShadingAttributesProperties | null;
48
+ //#endregion
49
+ export { alignmentFromCss, alignmentFromElement, alignmentToCss, bordersFromElement, characterSpacingFromCss, characterSpacingToCss, cssToTwip, indentFromElement, lineSpacingToCss, normalizeColorToHex, renderBorderCSS, renderParagraphStyles, renderTableCellStyles, resolveFontName, shadingFromCss, shadingFromElement, shadingToCss, sizeFromCss, sizeToCss, spacingFromElement, twipToCss };