docxkeun 0.1.3 → 0.2.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 (197) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +137 -16
  3. package/dist/api/editor.d.ts +172 -5
  4. package/dist/api/editor.js +814 -24
  5. package/dist/api/headers.d.ts +51 -0
  6. package/dist/api/headers.js +133 -0
  7. package/dist/api/index.d.ts +5 -1
  8. package/dist/api/index.js +4 -1
  9. package/dist/api/lists.d.ts +37 -0
  10. package/dist/api/lists.js +132 -0
  11. package/dist/api/parts.js +1 -0
  12. package/dist/api/positions.js +1 -0
  13. package/dist/api/revisions.d.ts +61 -0
  14. package/dist/api/revisions.js +390 -0
  15. package/dist/api/selection.d.ts +57 -0
  16. package/dist/api/selection.js +91 -0
  17. package/dist/charts/color.d.ts +45 -0
  18. package/dist/charts/color.js +322 -0
  19. package/dist/charts/format.d.ts +12 -0
  20. package/dist/charts/format.js +459 -0
  21. package/dist/charts/index.d.ts +11 -0
  22. package/dist/charts/index.js +8 -0
  23. package/dist/charts/model.d.ts +225 -0
  24. package/dist/charts/model.js +758 -0
  25. package/dist/charts/outline.d.ts +17 -0
  26. package/dist/charts/outline.js +214 -0
  27. package/dist/charts/render.d.ts +20 -0
  28. package/dist/charts/render.js +1772 -0
  29. package/dist/drawing/arrows.d.ts +37 -0
  30. package/dist/drawing/arrows.js +99 -0
  31. package/dist/drawing/formula.d.ts +40 -0
  32. package/dist/drawing/formula.js +159 -0
  33. package/dist/drawing/geometry.d.ts +61 -0
  34. package/dist/drawing/geometry.js +286 -0
  35. package/dist/drawing/index.d.ts +12 -0
  36. package/dist/drawing/index.js +8 -0
  37. package/dist/drawing/presets.d.ts +72 -0
  38. package/dist/drawing/presets.js +2874 -0
  39. package/dist/fonts/shaping/apply.d.ts +94 -0
  40. package/dist/fonts/shaping/apply.js +349 -0
  41. package/dist/fonts/shaping/arabic.d.ts +28 -0
  42. package/dist/fonts/shaping/arabic.js +235 -0
  43. package/dist/fonts/shaping/buffer.d.ts +53 -0
  44. package/dist/fonts/shaping/buffer.js +95 -0
  45. package/dist/fonts/shaping/gdef.d.ts +30 -0
  46. package/dist/fonts/shaping/gdef.js +66 -0
  47. package/dist/fonts/shaping/gpos.d.ts +86 -0
  48. package/dist/fonts/shaping/gpos.js +428 -0
  49. package/dist/fonts/shaping/gsub.d.ts +65 -0
  50. package/dist/fonts/shaping/gsub.js +313 -0
  51. package/dist/fonts/shaping/index.d.ts +32 -0
  52. package/dist/fonts/shaping/index.js +402 -0
  53. package/dist/fonts/shaping/indic.d.ts +6 -0
  54. package/dist/fonts/shaping/indic.js +805 -0
  55. package/dist/fonts/shaping/layout-common.d.ts +124 -0
  56. package/dist/fonts/shaping/layout-common.js +349 -0
  57. package/dist/fonts/shaping/plan.d.ts +87 -0
  58. package/dist/fonts/shaping/plan.js +152 -0
  59. package/dist/fonts/shaping/scripts.d.ts +26 -0
  60. package/dist/fonts/shaping/scripts.js +160 -0
  61. package/dist/fonts/shaping/shaper.d.ts +23 -0
  62. package/dist/fonts/shaping/shaper.js +5 -0
  63. package/dist/fonts/shaping/unicode.d.ts +34 -0
  64. package/dist/fonts/shaping/unicode.js +138 -0
  65. package/dist/images/bmp.d.ts +9 -0
  66. package/dist/images/bmp.js +234 -0
  67. package/dist/images/gif.d.ts +9 -0
  68. package/dist/images/gif.js +215 -0
  69. package/dist/images/index.d.ts +18 -0
  70. package/dist/images/index.js +63 -0
  71. package/dist/images/png-encode.d.ts +4 -0
  72. package/dist/images/png-encode.js +73 -0
  73. package/dist/images/size.d.ts +10 -0
  74. package/dist/images/size.js +83 -0
  75. package/dist/images/tiff.d.ts +14 -0
  76. package/dist/images/tiff.js +407 -0
  77. package/dist/index.d.ts +7 -2
  78. package/dist/index.js +5 -0
  79. package/dist/layout/bidi.d.ts +18 -0
  80. package/dist/layout/bidi.js +71 -0
  81. package/dist/layout/blocks.d.ts +20 -3
  82. package/dist/layout/blocks.js +88 -58
  83. package/dist/layout/cache.d.ts +31 -0
  84. package/dist/layout/cache.js +38 -0
  85. package/dist/layout/drawing.d.ts +30 -0
  86. package/dist/layout/drawing.js +120 -0
  87. package/dist/layout/engine.d.ts +3 -0
  88. package/dist/layout/engine.js +218 -11
  89. package/dist/layout/index.d.ts +1 -0
  90. package/dist/layout/index.js +1 -0
  91. package/dist/layout/lines.d.ts +63 -5
  92. package/dist/layout/lines.js +245 -20
  93. package/dist/layout/paint.d.ts +25 -3
  94. package/dist/layout/paint.js +26 -10
  95. package/dist/layout/shapes.d.ts +7 -0
  96. package/dist/layout/shapes.js +338 -0
  97. package/dist/layout/style.d.ts +4 -0
  98. package/dist/layout/style.js +2 -0
  99. package/dist/layout/types.d.ts +89 -2
  100. package/dist/math/boxes.d.ts +88 -0
  101. package/dist/math/boxes.js +166 -0
  102. package/dist/math/index.d.ts +29 -0
  103. package/dist/math/index.js +44 -0
  104. package/dist/math/layout.d.ts +13 -0
  105. package/dist/math/layout.js +771 -0
  106. package/dist/math/linear.d.ts +3 -0
  107. package/dist/math/linear.js +152 -0
  108. package/dist/math/omml.d.ts +15 -0
  109. package/dist/math/omml.js +57 -0
  110. package/dist/math/paths.d.ts +61 -0
  111. package/dist/math/paths.js +450 -0
  112. package/dist/math/symbols.d.ts +49 -0
  113. package/dist/math/symbols.js +269 -0
  114. package/dist/math/text.d.ts +53 -0
  115. package/dist/math/text.js +316 -0
  116. package/dist/metafile/canvas.d.ts +80 -0
  117. package/dist/metafile/canvas.js +515 -0
  118. package/dist/metafile/dib.d.ts +27 -0
  119. package/dist/metafile/dib.js +300 -0
  120. package/dist/metafile/emf.d.ts +31 -0
  121. package/dist/metafile/emf.js +591 -0
  122. package/dist/metafile/geometry.d.ts +49 -0
  123. package/dist/metafile/geometry.js +85 -0
  124. package/dist/metafile/index.d.ts +27 -0
  125. package/dist/metafile/index.js +34 -0
  126. package/dist/metafile/reader.d.ts +28 -0
  127. package/dist/metafile/reader.js +59 -0
  128. package/dist/metafile/state.d.ts +118 -0
  129. package/dist/metafile/state.js +172 -0
  130. package/dist/metafile/text.d.ts +17 -0
  131. package/dist/metafile/text.js +130 -0
  132. package/dist/metafile/wmf.d.ts +33 -0
  133. package/dist/metafile/wmf.js +395 -0
  134. package/dist/model/content.d.ts +92 -7
  135. package/dist/model/content.js +251 -17
  136. package/dist/model/document.d.ts +34 -1
  137. package/dist/model/document.js +80 -1
  138. package/dist/model/fields.d.ts +4 -0
  139. package/dist/model/fields.js +10 -0
  140. package/dist/model/numbering.d.ts +2 -0
  141. package/dist/model/numbering.js +22 -0
  142. package/dist/model/props.d.ts +2 -0
  143. package/dist/model/props.js +3 -0
  144. package/dist/opc/index.d.ts +1 -1
  145. package/dist/opc/package.d.ts +34 -0
  146. package/dist/opc/package.js +58 -4
  147. package/dist/pdf/export.js +97 -6
  148. package/dist/pdf/images.d.ts +7 -0
  149. package/dist/pdf/images.js +39 -2
  150. package/dist/render/activity.d.ts +138 -0
  151. package/dist/render/activity.js +794 -0
  152. package/dist/render/clipboard.d.ts +29 -0
  153. package/dist/render/clipboard.js +401 -0
  154. package/dist/render/comments.d.ts +166 -0
  155. package/dist/render/comments.js +779 -0
  156. package/dist/render/context-menu.d.ts +124 -0
  157. package/dist/render/context-menu.js +525 -0
  158. package/dist/render/editing.d.ts +146 -5
  159. package/dist/render/editing.js +678 -53
  160. package/dist/render/index.d.ts +12 -0
  161. package/dist/render/index.js +11 -0
  162. package/dist/render/navigation-panel.d.ts +76 -0
  163. package/dist/render/navigation-panel.js +431 -0
  164. package/dist/render/selection.js +5 -0
  165. package/dist/render/svg.d.ts +4 -6
  166. package/dist/render/svg.js +69 -7
  167. package/dist/render/toolbar.d.ts +83 -0
  168. package/dist/render/toolbar.js +505 -0
  169. package/dist/render/ui/comment-layout.d.ts +39 -0
  170. package/dist/render/ui/comment-layout.js +79 -0
  171. package/dist/render/ui/icons.d.ts +6 -0
  172. package/dist/render/ui/icons.js +38 -0
  173. package/dist/render/ui/menu.d.ts +38 -0
  174. package/dist/render/ui/menu.js +274 -0
  175. package/dist/render/ui/nav-model.d.ts +11 -0
  176. package/dist/render/ui/nav-model.js +34 -0
  177. package/dist/render/ui/overflow.d.ts +5 -0
  178. package/dist/render/ui/overflow.js +18 -0
  179. package/dist/render/ui/popover.d.ts +18 -0
  180. package/dist/render/ui/popover.js +109 -0
  181. package/dist/render/ui/theme.d.ts +2 -0
  182. package/dist/render/ui/theme.js +29 -0
  183. package/dist/render/undo.d.ts +76 -0
  184. package/dist/render/undo.js +144 -0
  185. package/dist/render/viewer.d.ts +100 -7
  186. package/dist/render/viewer.js +302 -92
  187. package/dist/security/policy.d.ts +3 -0
  188. package/dist/security/policy.js +6 -2
  189. package/dist/security/protection.d.ts +1 -0
  190. package/dist/security/protection.js +1 -1
  191. package/dist/text/bidi-data.d.ts +53 -0
  192. package/dist/text/bidi-data.js +318 -0
  193. package/dist/text/bidi.d.ts +37 -0
  194. package/dist/text/bidi.js +508 -0
  195. package/dist/xml/ns.d.ts +5 -0
  196. package/dist/xml/ns.js +7 -0
  197. package/package.json +9 -2
@@ -0,0 +1,3 @@
1
+ import type { XmlElement } from '../xml/dom.js';
2
+ /** The equation (m:oMath or m:oMathPara) in Office's linear format; equations of a paragraph on separate lines. */
3
+ export declare function mathToText(math: XmlElement): string;
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Equations as text in Office's linear format (UnicodeMath, as Word shows an equation switched
3
+ * to "Linear"): x=(-b±√(b^2-4ac))/(2a). Used for search, accessibility and AI tools, so it keeps
4
+ * Word's operators (▒ after n-ary operators, ⁡ function application, ■ matrices) where they exist.
5
+ */
6
+ import { elements, firstChild } from '../xml/dom.js';
7
+ import { charProp, isPropertyElement, onOff, runText, val } from './omml.js';
8
+ const WRAPPERS = new Set(['w:ins', 'w:moveTo', 'w:smartTag', 'w:customXml', 'w:hyperlink', 'w:fldSimple']);
9
+ /**
10
+ * An operand that needs no parentheses: one character (with any combining marks), a number, or
11
+ * something already enclosed in one matching pair of brackets.
12
+ */
13
+ function isAtomic(s) {
14
+ if (/^\p{L}\p{M}*$/u.test(s) || /^\d+(\.\d+)?$/.test(s) || [...s].length === 1)
15
+ return true;
16
+ return isEnclosed(s);
17
+ }
18
+ const PAIRS = { '(': ')', '[': ']', '{': '}', '〖': '〗', '⟨': '⟩', '|': '|', '‖': '‖' };
19
+ function isEnclosed(s) {
20
+ const open = s[0];
21
+ const close = open ? PAIRS[open] : undefined;
22
+ if (!open || !close || s[s.length - 1] !== close || s.length < 2)
23
+ return false;
24
+ if (open === close)
25
+ return s.indexOf(open, 1) === s.length - 1;
26
+ let depth = 0;
27
+ for (let i = 0; i < s.length; i++) {
28
+ if (s[i] === open)
29
+ depth++;
30
+ else if (s[i] === close) {
31
+ depth--;
32
+ if (depth === 0 && i < s.length - 1)
33
+ return false;
34
+ }
35
+ }
36
+ return depth === 0;
37
+ }
38
+ function wrap(s) {
39
+ return isAtomic(s) ? s : `(${s})`;
40
+ }
41
+ /** Arguments of n-ary operators and functions use Word's invisible brackets 〖〗. */
42
+ function wrapArgument(s) {
43
+ return isAtomic(s) ? s : `〖${s}〗`;
44
+ }
45
+ function content(el) {
46
+ if (!el)
47
+ return '';
48
+ let s = '';
49
+ for (const c of elements(el))
50
+ s += node(c);
51
+ return s;
52
+ }
53
+ function arg(el, name) {
54
+ return content(firstChild(el, name));
55
+ }
56
+ function node(el) {
57
+ switch (el.name) {
58
+ case 'm:r':
59
+ case 'w:r':
60
+ return runText(el);
61
+ case 'm:f': {
62
+ const type = val(firstChild(el, 'm:fPr'), 'm:type') ?? 'bar';
63
+ const op = type === 'skw' ? '⁄' : type === 'noBar' ? '¦' : '/';
64
+ return `${wrap(arg(el, 'm:num'))}${op}${wrap(arg(el, 'm:den'))}`;
65
+ }
66
+ case 'm:sSup':
67
+ return `${wrap(arg(el, 'm:e'))}^${wrap(arg(el, 'm:sup'))}`;
68
+ case 'm:sSub':
69
+ return `${wrap(arg(el, 'm:e'))}_${wrap(arg(el, 'm:sub'))}`;
70
+ case 'm:sSubSup':
71
+ return `${wrap(arg(el, 'm:e'))}_${wrap(arg(el, 'm:sub'))}^${wrap(arg(el, 'm:sup'))}`;
72
+ case 'm:sPre': {
73
+ const sub = arg(el, 'm:sub');
74
+ const sup = arg(el, 'm:sup');
75
+ return `〖${sub ? `_${wrap(sub)}` : ''}${sup ? `^${wrap(sup)}` : ''}〗${wrap(arg(el, 'm:e'))}`;
76
+ }
77
+ case 'm:rad': {
78
+ const body = arg(el, 'm:e');
79
+ const deg = onOff(firstChild(el, 'm:radPr'), 'm:degHide', false) ? '' : arg(el, 'm:deg');
80
+ if (!deg)
81
+ return `√${wrap(body)}`;
82
+ if (deg === '3')
83
+ return `∛${wrap(body)}`;
84
+ if (deg === '4')
85
+ return `∜${wrap(body)}`;
86
+ return `√(${deg}&${body})`;
87
+ }
88
+ case 'm:nary': {
89
+ const pr = firstChild(el, 'm:naryPr');
90
+ const chr = charProp(pr, 'm:chr', '∫') || '∫';
91
+ const sub = onOff(pr, 'm:subHide', false) ? '' : arg(el, 'm:sub');
92
+ const sup = onOff(pr, 'm:supHide', false) ? '' : arg(el, 'm:sup');
93
+ return `${chr}${sub ? `_${wrap(sub)}` : ''}${sup ? `^${wrap(sup)}` : ''}▒${wrapArgument(arg(el, 'm:e'))}`;
94
+ }
95
+ case 'm:d': {
96
+ const pr = firstChild(el, 'm:dPr');
97
+ const beg = charProp(pr, 'm:begChr', '(');
98
+ const end = charProp(pr, 'm:endChr', ')');
99
+ const sep = charProp(pr, 'm:sepChr', '|');
100
+ const inner = elements(el, 'm:e').map(content).join(sep);
101
+ if (!beg && !end)
102
+ return `〖${inner}〗`;
103
+ return `${beg || '├'}${inner}${end || '┤'}`;
104
+ }
105
+ case 'm:m': {
106
+ const rows = elements(el, 'm:mr').map((r) => elements(r, 'm:e').map(content).join('&'));
107
+ return `■(${rows.join('@')})`;
108
+ }
109
+ case 'm:eqArr':
110
+ return `█(${elements(el, 'm:e').map(content).join('@')})`;
111
+ case 'm:acc': {
112
+ const chr = charProp(firstChild(el, 'm:accPr'), 'm:chr', '̂') || '̂';
113
+ return `${wrap(arg(el, 'm:e'))}${chr}`;
114
+ }
115
+ case 'm:bar': {
116
+ const top = val(firstChild(el, 'm:barPr'), 'm:pos') === 'top';
117
+ return top ? `${wrap(arg(el, 'm:e'))}̅` : `▁${wrap(arg(el, 'm:e'))}`;
118
+ }
119
+ case 'm:func':
120
+ return `${arg(el, 'm:fName')}⁡${wrapArgument(arg(el, 'm:e'))}`;
121
+ case 'm:limLow':
122
+ return `${arg(el, 'm:e')}┬${wrap(arg(el, 'm:lim'))}`;
123
+ case 'm:limUpp':
124
+ return `${arg(el, 'm:e')}┴${wrap(arg(el, 'm:lim'))}`;
125
+ case 'm:groupChr': {
126
+ const chr = charProp(firstChild(el, 'm:groupChrPr'), 'm:chr', '⏟') || '⏟';
127
+ return `${chr}${wrap(arg(el, 'm:e'))}`;
128
+ }
129
+ case 'm:box':
130
+ return `□(${arg(el, 'm:e')})`;
131
+ case 'm:borderBox':
132
+ return `▭(${arg(el, 'm:e')})`;
133
+ case 'm:phant':
134
+ return `⟡(${arg(el, 'm:e')})`;
135
+ case 'm:oMathPara':
136
+ return elements(el, 'm:oMath').map(content).join('\n');
137
+ case 'w:sdt':
138
+ return content(firstChild(el, 'w:sdtContent'));
139
+ default:
140
+ if (isPropertyElement(el.name))
141
+ return '';
142
+ if (el.name.startsWith('m:') || WRAPPERS.has(el.name))
143
+ return content(el);
144
+ return '';
145
+ }
146
+ }
147
+ /** The equation (m:oMath or m:oMathPara) in Office's linear format; equations of a paragraph on separate lines. */
148
+ export function mathToText(math) {
149
+ if (math.name === 'm:oMathPara')
150
+ return node(math);
151
+ return content(math);
152
+ }
@@ -0,0 +1,15 @@
1
+ import type { XmlElement } from '../xml/dom.js';
2
+ /** `m:val` of a property child, undefined when the property is absent. */
3
+ export declare function val(pr: XmlElement | undefined, name: string): string | undefined;
4
+ /** A character property (m:chr, m:begChr…). Present without m:val means the default. */
5
+ export declare function charProp(pr: XmlElement | undefined, name: string, fallback: string): string;
6
+ export declare function onOff(pr: XmlElement | undefined, name: string, fallback: boolean): boolean;
7
+ export declare function numProp(pr: XmlElement | undefined, name: string): number | undefined;
8
+ /** WordprocessingML on/off (w:b, w:i): `w:val` false values turn it off. */
9
+ export declare function wOnOff(rPr: XmlElement | undefined, name: string): boolean | undefined;
10
+ /** Colour from `m:ctrlPr/w:rPr/w:color` of a structure, which Word uses for bars and delimiters. */
11
+ export declare function ctrlColor(pr: XmlElement | undefined): string | undefined;
12
+ /** Text of a run: its m:t (and stray w:t) children in order. */
13
+ export declare function runText(run: XmlElement): string;
14
+ /** Elements that only carry properties or bookkeeping, never equation content. */
15
+ export declare function isPropertyElement(name: string): boolean;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Reading OMML properties. Math properties sit in `m:*Pr` elements as children with an `m:val`
3
+ * attribute; on/off properties are on when the element is present without a value.
4
+ */
5
+ import { attr, elements, firstChild, textContent } from '../xml/dom.js';
6
+ const OFF = new Set(['0', 'off', 'false']);
7
+ /** `m:val` of a property child, undefined when the property is absent. */
8
+ export function val(pr, name) {
9
+ return attr(firstChild(pr, name), 'm:val');
10
+ }
11
+ /** A character property (m:chr, m:begChr…). Present without m:val means the default. */
12
+ export function charProp(pr, name, fallback) {
13
+ const v = val(pr, name);
14
+ return v === undefined ? fallback : v;
15
+ }
16
+ export function onOff(pr, name, fallback) {
17
+ const e = firstChild(pr, name);
18
+ if (!e)
19
+ return fallback;
20
+ const v = attr(e, 'm:val') ?? attr(e, 'w:val');
21
+ return v === undefined || !OFF.has(v.toLowerCase());
22
+ }
23
+ export function numProp(pr, name) {
24
+ const v = val(pr, name);
25
+ if (v === undefined)
26
+ return undefined;
27
+ const n = Number(v);
28
+ return Number.isFinite(n) ? n : undefined;
29
+ }
30
+ /** WordprocessingML on/off (w:b, w:i): `w:val` false values turn it off. */
31
+ export function wOnOff(rPr, name) {
32
+ const e = firstChild(rPr, name);
33
+ if (!e)
34
+ return undefined;
35
+ const v = attr(e, 'w:val');
36
+ return v === undefined || !OFF.has(v.toLowerCase());
37
+ }
38
+ /** Colour from `m:ctrlPr/w:rPr/w:color` of a structure, which Word uses for bars and delimiters. */
39
+ export function ctrlColor(pr) {
40
+ const color = attr(firstChild(firstChild(firstChild(pr, 'm:ctrlPr'), 'w:rPr'), 'w:color'), 'w:val');
41
+ return color && /^[0-9a-fA-F]{6}$/.test(color) ? color.toUpperCase() : undefined;
42
+ }
43
+ /** Text of a run: its m:t (and stray w:t) children in order. */
44
+ export function runText(run) {
45
+ let s = '';
46
+ for (const c of elements(run)) {
47
+ if (c.name === 'm:t' || c.name === 'w:t')
48
+ s += textContent(c);
49
+ else if (c.name === 'w:tab')
50
+ s += ' ';
51
+ }
52
+ return s;
53
+ }
54
+ /** Elements that only carry properties or bookkeeping, never equation content. */
55
+ export function isPropertyElement(name) {
56
+ return name.endsWith('Pr') || name === 'm:ctrlPr';
57
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Vector shapes for the parts of an equation that must stretch or that the bundled fonts lack:
3
+ * radicals, tall delimiters, horizontal braces, integrals, big operators, accents and arrows.
4
+ * Shapes are built with y pointing up (the way glyphs are designed) and flipped to the display
5
+ * list's y-down coordinates when turned into path commands.
6
+ */
7
+ import type { PathCommand, PathItem } from '../layout/types.js';
8
+ import type { AccentKind, DelimiterKind } from './symbols.js';
9
+ export type Pt = [number, number];
10
+ /** Closed polygons (y up) as path commands (y down). */
11
+ export declare function polygons(shapes: Pt[][]): PathCommand[];
12
+ /** An ellipse (y up) as four cubic arcs (y down). */
13
+ export declare function ellipse(cx: number, cy: number, rx: number, ry: number): PathCommand[];
14
+ export declare function filled(commands: PathCommand[], color: string): PathItem;
15
+ export declare function stroked(commands: PathCommand[], color: string, width: number): PathItem;
16
+ /**
17
+ * Outline of a polyline stroked with a width per segment. Joins are mitred, falling back to a
18
+ * bevel when the mitre would reach further than `limit` half-widths (very sharp corners).
19
+ */
20
+ export declare function strokeOutline(pts: Pt[], widths: number[], limit?: number): Pt[];
21
+ /** Outline of a sampled curve stroked with a width that varies along it (s from 0 to 1). */
22
+ export declare function taperOutline(pts: Pt[], width: (s: number) => number): Pt[];
23
+ export type Frame = (along: number, across: number) => Pt;
24
+ /** A vertical delimiter occupying x0..x0+W and y bottom..bottom+L (y up). */
25
+ export declare function verticalFrame(x0: number, width: number, bottom: number, side: 'left' | 'right'): Frame;
26
+ /** A horizontal delimiter occupying x0..x0+L and y bottom..bottom+W (y up). */
27
+ export declare function horizontalFrame(x0: number, depth: number, bottom: number, outer: 'top' | 'bottom'): Frame;
28
+ /** Natural thickness (across) of a stretchy delimiter of length L, before side bearings. */
29
+ export declare function delimiterWidth(kind: DelimiterKind, L: number, em: number): number;
30
+ /** Polygons of a stretchy delimiter in (along, across) coordinates. */
31
+ export declare function delimiterShape(kind: DelimiterKind, L: number, W: number, em: number): Pt[][];
32
+ export declare function mapShape(shape: Pt[][], frame: Frame): Pt[][];
33
+ export declare function radicalShape(x0: number, bottom: number, signWidth: number, top: number, barEnd: number, rule: number, em: number): Pt[];
34
+ /** Polygons and terminal circles of an integral in the box x0..x0+W, bottom..bottom+H (y up). */
35
+ export declare function integralShape(x0: number, bottom: number, W: number, H: number, em: number): {
36
+ outline: Pt[];
37
+ balls: Array<[number, number, number]>;
38
+ };
39
+ /** Big operators drawn as shapes (y up) in x0..x0+W, bottom..bottom+H. Returns undefined for unknown ones. */
40
+ export declare function bigOperatorPaths(ch: string, x0: number, bottom: number, W: number, H: number, em: number, color: string): PathItem[] | undefined;
41
+ export declare function arrowPaths(x0: number, x1: number, y: number, em: number, spec: {
42
+ left: boolean;
43
+ right: boolean;
44
+ double: boolean;
45
+ harpoon: boolean;
46
+ }, color: string, small: boolean): PathItem[];
47
+ /** Natural width of an accent (em), and whether it stretches over wide bases. */
48
+ export declare function accentMetrics(kind: AccentKind): {
49
+ width: number;
50
+ stretch: boolean;
51
+ };
52
+ /** Draw an accent; returns the items and the accent's ink height. */
53
+ export declare function accentPaths(kind: AccentKind, x0: number, w: number, y: number, em: number, color: string, arrow?: {
54
+ left: boolean;
55
+ right: boolean;
56
+ double: boolean;
57
+ harpoon: boolean;
58
+ }): {
59
+ items: PathItem[];
60
+ height: number;
61
+ };