documents.js 1.63.0 → 1.65.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 (187) hide show
  1. package/README.md +124 -25
  2. package/dist/convert/convert.cjs +3 -3
  3. package/dist/convert/convert.d.cts +5 -2
  4. package/dist/convert/convert.d.ts +4 -1
  5. package/dist/convert/convert.js +3 -3
  6. package/dist/edit/docx/content.d.cts +1 -1
  7. package/dist/edit/docx/content.d.ts +1 -1
  8. package/dist/edit/docx/paragraph.d.cts +3 -3
  9. package/dist/edit/docx/paragraph.d.ts +3 -3
  10. package/dist/edit/ods/address.cjs +42 -24
  11. package/dist/edit/ods/address.d.cts +12 -2
  12. package/dist/edit/ods/address.d.ts +12 -2
  13. package/dist/edit/ods/address.js +39 -25
  14. package/dist/edit/ods/column-row.cjs +68 -6
  15. package/dist/edit/ods/column-row.d.cts +5 -1
  16. package/dist/edit/ods/column-row.d.ts +5 -1
  17. package/dist/edit/ods/column-row.js +68 -10
  18. package/dist/edit/ods/content.cjs +10 -2
  19. package/dist/edit/ods/content.js +10 -2
  20. package/dist/edit/ods/floating.cjs +90 -0
  21. package/dist/edit/ods/floating.d.cts +7 -0
  22. package/dist/edit/ods/floating.d.ts +7 -0
  23. package/dist/edit/ods/floating.js +88 -0
  24. package/dist/edit/ods/print-settings.cjs +158 -2
  25. package/dist/edit/ods/print-settings.js +159 -3
  26. package/dist/edit/ods/sheet.cjs +13 -0
  27. package/dist/edit/ods/sheet.d.cts +5 -1
  28. package/dist/edit/ods/sheet.d.ts +5 -1
  29. package/dist/edit/ods/sheet.js +14 -1
  30. package/dist/edit/odt/content.cjs +8 -4
  31. package/dist/edit/odt/content.js +8 -4
  32. package/dist/edit/odt/editor.cjs +7 -0
  33. package/dist/edit/odt/editor.d.cts +3 -0
  34. package/dist/edit/odt/editor.d.ts +3 -0
  35. package/dist/edit/odt/editor.js +7 -0
  36. package/dist/edit/odt/formula.cjs +19 -0
  37. package/dist/edit/odt/formula.d.cts +8 -0
  38. package/dist/edit/odt/formula.d.ts +8 -0
  39. package/dist/edit/odt/formula.js +17 -0
  40. package/dist/evaluate-BU5N1Jk1.d.ts +11 -0
  41. package/dist/evaluate-BhMXY6DM.d.cts +11 -0
  42. package/dist/firebird/backup.d.cts +1 -1
  43. package/dist/firebird/backup.d.ts +1 -1
  44. package/dist/firebird/data.cjs +30 -16
  45. package/dist/firebird/data.d.cts +3 -2
  46. package/dist/firebird/data.d.ts +3 -2
  47. package/dist/firebird/data.js +30 -17
  48. package/dist/fonts/ooxml.d.cts +1 -1
  49. package/dist/fonts/registry.d.cts +1 -1
  50. package/dist/formula-CgydMiTt.d.ts +10 -0
  51. package/dist/formula-CiwPw8nY.d.cts +10 -0
  52. package/dist/hsqldb/binary-script.d.cts +1 -1
  53. package/dist/hsqldb/binary-script.d.ts +1 -1
  54. package/dist/hsqldb/cache.d.cts +1 -1
  55. package/dist/hsqldb/cache.d.ts +1 -1
  56. package/dist/hsqldb/rowformat.cjs +22 -13
  57. package/dist/hsqldb/rowformat.js +22 -13
  58. package/dist/hsqldb/script.d.cts +1 -18
  59. package/dist/hsqldb/script.d.ts +1 -18
  60. package/dist/index.cjs +56 -0
  61. package/dist/index.d.cts +24 -10
  62. package/dist/index.d.ts +23 -9
  63. package/dist/index.js +15 -2
  64. package/dist/layout/sheets.cjs +30 -24
  65. package/dist/layout/sheets.js +31 -25
  66. package/dist/layout/slides.cjs +6 -4
  67. package/dist/layout/slides.js +7 -5
  68. package/dist/lexer-DGPWx_f2.d.cts +42 -0
  69. package/dist/lexer-DGPWx_f2.d.ts +42 -0
  70. package/dist/mathml/compose.cjs +8 -0
  71. package/dist/mathml/compose.js +8 -0
  72. package/dist/mathml/layout-types.d.cts +14 -2
  73. package/dist/mathml/layout-types.d.ts +14 -2
  74. package/dist/mathml/layout.cjs +62 -3
  75. package/dist/mathml/layout.d.cts +1 -1
  76. package/dist/mathml/layout.d.ts +1 -1
  77. package/dist/mathml/layout.js +62 -3
  78. package/dist/mathml/metrics.d.cts +17 -1
  79. package/dist/mathml/metrics.d.ts +17 -1
  80. package/dist/mathml/operators.cjs +1 -1
  81. package/dist/mathml/operators.js +1 -1
  82. package/dist/mathml/variant.d.cts +1 -6
  83. package/dist/mathml/variant.d.ts +1 -6
  84. package/dist/odb/csv.d.cts +1 -1
  85. package/dist/odb/csv.d.ts +1 -1
  86. package/dist/odb/formula/definition.cjs +49 -0
  87. package/dist/odb/formula/definition.d.cts +8 -0
  88. package/dist/odb/formula/definition.d.ts +8 -0
  89. package/dist/odb/formula/definition.js +46 -0
  90. package/dist/odb/formula/errors.cjs +47 -0
  91. package/dist/odb/formula/errors.d.cts +21 -0
  92. package/dist/odb/formula/errors.d.ts +21 -0
  93. package/dist/odb/formula/errors.js +43 -0
  94. package/dist/odb/formula/evaluate.cjs +283 -0
  95. package/dist/odb/formula/evaluate.d.cts +43 -0
  96. package/dist/odb/formula/evaluate.d.ts +43 -0
  97. package/dist/odb/formula/evaluate.js +281 -0
  98. package/dist/odb/formula/parser.cjs +198 -0
  99. package/dist/odb/formula/parser.d.cts +29 -0
  100. package/dist/odb/formula/parser.d.ts +29 -0
  101. package/dist/odb/formula/parser.js +197 -0
  102. package/dist/odb/read.d.cts +1 -1
  103. package/dist/odb/read.d.ts +1 -1
  104. package/dist/odb/report/content.cjs +27 -0
  105. package/dist/odb/report/content.d.cts +14 -0
  106. package/dist/odb/report/content.d.ts +14 -0
  107. package/dist/odb/report/content.js +25 -0
  108. package/dist/odb/report/render.cjs +106 -0
  109. package/dist/odb/report/render.d.cts +7 -0
  110. package/dist/odb/report/render.d.ts +7 -0
  111. package/dist/odb/report/render.js +106 -0
  112. package/dist/odb/report/source.cjs +45 -0
  113. package/dist/odb/report/source.d.cts +14 -0
  114. package/dist/odb/report/source.d.ts +14 -0
  115. package/dist/odb/report/source.js +42 -0
  116. package/dist/odb/spreadsheet.d.cts +1 -1
  117. package/dist/odb/spreadsheet.d.ts +1 -1
  118. package/dist/odb/sql/errors.cjs +38 -0
  119. package/dist/odb/sql/errors.d.cts +17 -0
  120. package/dist/odb/sql/errors.d.ts +17 -0
  121. package/dist/odb/sql/errors.js +35 -0
  122. package/dist/odb/sql/evaluate.cjs +312 -0
  123. package/dist/odb/sql/evaluate.d.cts +2 -0
  124. package/dist/odb/sql/evaluate.d.ts +2 -0
  125. package/dist/odb/sql/evaluate.js +311 -0
  126. package/dist/odb/sql/lexer.cjs +282 -0
  127. package/dist/odb/sql/lexer.d.cts +2 -0
  128. package/dist/odb/sql/lexer.d.ts +2 -0
  129. package/dist/odb/sql/lexer.js +281 -0
  130. package/dist/odb/sql/parser.cjs +479 -0
  131. package/dist/odb/sql/parser.d.cts +2 -0
  132. package/dist/odb/sql/parser.d.ts +2 -0
  133. package/dist/odb/sql/parser.js +478 -0
  134. package/dist/odb/values.cjs +75 -0
  135. package/dist/odb/values.d.cts +2 -0
  136. package/dist/odb/values.d.ts +2 -0
  137. package/dist/odb/values.js +69 -0
  138. package/dist/odf/odt/read.cjs +43 -21
  139. package/dist/odf/odt/read.js +43 -21
  140. package/dist/odf-package/formula.cjs +59 -0
  141. package/dist/odf-package/formula.d.cts +11 -0
  142. package/dist/odf-package/formula.d.ts +11 -0
  143. package/dist/odf-package/formula.js +58 -0
  144. package/dist/odf-package/manifest.cjs +29 -0
  145. package/dist/odf-package/manifest.d.cts +5 -2
  146. package/dist/odf-package/manifest.d.ts +5 -2
  147. package/dist/odf-package/manifest.js +30 -2
  148. package/dist/odf-package/media.cjs +2 -1
  149. package/dist/odf-package/media.js +2 -2
  150. package/dist/omml/read.cjs +265 -0
  151. package/dist/omml/read.d.cts +12 -0
  152. package/dist/omml/read.d.ts +12 -0
  153. package/dist/omml/read.js +263 -0
  154. package/dist/omml/shared.cjs +67 -0
  155. package/dist/omml/shared.d.cts +2 -0
  156. package/dist/omml/shared.d.ts +2 -0
  157. package/dist/omml/shared.js +64 -0
  158. package/dist/omml/write.cjs +3 -51
  159. package/dist/omml/write.d.cts +2 -2
  160. package/dist/omml/write.d.ts +2 -2
  161. package/dist/omml/write.js +1 -49
  162. package/dist/ooxml/docx/extras.cjs +15 -0
  163. package/dist/ooxml/docx/extras.d.cts +12 -0
  164. package/dist/ooxml/docx/extras.d.ts +12 -0
  165. package/dist/ooxml/docx/extras.js +14 -0
  166. package/dist/ooxml/docx/formula.cjs +109 -0
  167. package/dist/ooxml/docx/formula.d.cts +2 -0
  168. package/dist/ooxml/docx/formula.d.ts +2 -0
  169. package/dist/ooxml/docx/formula.js +108 -0
  170. package/dist/ooxml/docx/read.cjs +10 -2
  171. package/dist/ooxml/docx/read.d.cts +6 -2
  172. package/dist/ooxml/docx/read.d.ts +6 -2
  173. package/dist/ooxml/docx/read.js +11 -3
  174. package/dist/parser-B9vC1T6T.d.cts +101 -0
  175. package/dist/parser-DQSgYJzQ.d.ts +101 -0
  176. package/dist/{registry-CtPhMD0f.d.cts → registry-lqJej0Jr.d.cts} +1 -1
  177. package/dist/script-DsGGIzGU.d.cts +19 -0
  178. package/dist/script-DsGGIzGU.d.ts +19 -0
  179. package/dist/shared-DLZ3IQUl.d.cts +15 -0
  180. package/dist/shared-DUOzjwcL.d.ts +15 -0
  181. package/dist/values-BetetbaH.d.cts +23 -0
  182. package/dist/values-BetetbaH.d.ts +23 -0
  183. package/dist/variant-BMrebjMw.d.cts +7 -0
  184. package/dist/variant-BMrebjMw.d.ts +7 -0
  185. package/dist/{write-DuyfnbL_.d.cts → write-BQ6SK8r8.d.cts} +2 -6
  186. package/dist/{write-Zqwx6pka.d.ts → write-THs7ipBq.d.ts} +2 -6
  187. package/package.json +2 -2
@@ -37,7 +37,11 @@ function unsupported(ctx, element) {
37
37
  }
38
38
  function layoutToken(rawText, variant, ctx) {
39
39
  const styled = require_mathml_variant.applyMathVariant(rawText, variant);
40
+ const nominalAscentPt = ctx.metrics.ascentPerEm * ctx.sizePt;
41
+ const nominalDescentPt = ctx.metrics.descentPerEm * ctx.sizePt;
40
42
  let widthPt = 0;
43
+ let ascentPt = 0;
44
+ let descentPt = 0;
41
45
  let text = "";
42
46
  for (const ch of styled) {
43
47
  const codePoint = ch.codePointAt(0);
@@ -52,10 +56,10 @@ function layoutToken(rawText, variant, ctx) {
52
56
  }
53
57
  text += ch;
54
58
  widthPt += glyph.advanceWidthPt;
59
+ ascentPt = Math.max(ascentPt, glyph.inkAscentPt ?? nominalAscentPt);
60
+ descentPt = Math.max(descentPt, glyph.inkDescentPt ?? nominalDescentPt);
55
61
  }
56
62
  if (text.length === 0) return require_mathml_compose.EMPTY_BOX;
57
- const ascentPt = ctx.metrics.ascentPerEm * ctx.sizePt;
58
- const descentPt = ctx.metrics.descentPerEm * ctx.sizePt;
59
63
  const items = [{
60
64
  kind: "glyphs",
61
65
  xPt: 0,
@@ -80,8 +84,63 @@ function tokenVariant(element, intrinsicDefault, ctx) {
80
84
  function miIntrinsicDefault(content) {
81
85
  return [...content].length === 1 ? "italic" : "normal";
82
86
  }
87
+ function isStretchyOperator(element) {
88
+ if (require_mathml_nodes.elementLocalName(element) !== "mo") return false;
89
+ if (require_mathml_nodes.attrValue(element, "stretchy") === "false") return false;
90
+ return require_mathml_operators.operatorProperties(require_mathml_nodes.textContent(element).trim()).stretchy;
91
+ }
92
+ function stretchedBox(result, text, ctx) {
93
+ const axisPt = ctx.metrics.axisHeightPt;
94
+ const inkHeightPt = result.inkAscentPt + result.inkDescentPt;
95
+ const originAboveBaselinePt = axisPt - (result.inkAscentPt - result.inkDescentPt) / 2;
96
+ const ascentPt = axisPt + inkHeightPt / 2;
97
+ const descentPt = inkHeightPt / 2 - axisPt;
98
+ const items = [{
99
+ kind: "assembled-glyphs",
100
+ placements: result.placements.map((placement) => ({
101
+ glyphId: placement.glyphId,
102
+ xPt: 0,
103
+ yPt: ascentPt - originAboveBaselinePt - placement.offsetPt
104
+ })),
105
+ text,
106
+ sizePt: ctx.sizePt,
107
+ color: ctx.color
108
+ }];
109
+ return {
110
+ widthPt: result.advanceWidthPt,
111
+ ascentPt,
112
+ descentPt,
113
+ heightPt: ascentPt + descentPt,
114
+ items
115
+ };
116
+ }
117
+ function stretchOperator(element, targetSizePt, ctx) {
118
+ const text = require_mathml_nodes.textContent(element).trim();
119
+ const codePoints = [...text];
120
+ if (codePoints.length !== 1) return;
121
+ const codePoint = codePoints[0]?.codePointAt(0);
122
+ if (codePoint === void 0) return;
123
+ const result = ctx.metrics.stretch(codePoint, "vertical", targetSizePt, ctx.sizePt);
124
+ if (result === void 0 || result.kind === "base") return;
125
+ return stretchedBox(result, text, ctx);
126
+ }
127
+ function stretchRowOperators(children, boxes, ctx) {
128
+ const stretchy = children.map(isStretchyOperator);
129
+ if (!stretchy.includes(true)) return boxes;
130
+ const others = boxes.filter((_, index) => stretchy[index] !== true);
131
+ if (others.length === 0) return boxes;
132
+ const axisPt = ctx.metrics.axisHeightPt;
133
+ const maxAscentPt = others.reduce((max, box) => Math.max(max, box.ascentPt), 0);
134
+ const maxDescentPt = others.reduce((max, box) => Math.max(max, box.descentPt), 0);
135
+ const targetSizePt = 2 * Math.max(maxAscentPt - axisPt, maxDescentPt + axisPt);
136
+ return boxes.map((box, index) => {
137
+ if (stretchy[index] !== true) return box;
138
+ const element = children[index];
139
+ return (element === void 0 ? void 0 : stretchOperator(element, targetSizePt, ctx)) ?? box;
140
+ });
141
+ }
83
142
  function layoutRowChildren(children, ctx) {
84
- const boxes = children.map((child) => layoutNode(child, ctx));
143
+ const boxes = stretchRowOperators(children, children.map((child) => layoutNode(child, ctx)), ctx);
85
144
  const gapsPt = children.map((child, index) => {
86
145
  if (index === 0) return 0;
87
146
  const previous = children[index - 1];
@@ -1,7 +1,7 @@
1
+ import { t as MathVariant } from "../variant-BMrebjMw.cjs";
1
2
  import { r as MathMlNode } from "../nodes-pArN9ilm.cjs";
2
3
  import { MathBox, MathColor, MathDiagnostic, MathLayoutResult } from "./layout-types.cjs";
3
4
  import { MathFontMetrics } from "./metrics.cjs";
4
- import { MathVariant } from "./variant.cjs";
5
5
  //#region src/mathml/layout.d.ts
6
6
  interface LayoutFormulaOptions {
7
7
  readonly metrics: MathFontMetrics;
@@ -1,7 +1,7 @@
1
+ import { t as MathVariant } from "../variant-BMrebjMw.js";
1
2
  import { r as MathMlNode } from "../nodes-pArN9ilm.js";
2
3
  import { MathBox, MathColor, MathDiagnostic, MathLayoutResult } from "./layout-types.js";
3
4
  import { MathFontMetrics } from "./metrics.js";
4
- import { MathVariant } from "./variant.js";
5
5
  //#region src/mathml/layout.d.ts
6
6
  interface LayoutFormulaOptions {
7
7
  readonly metrics: MathFontMetrics;
@@ -36,7 +36,11 @@ function unsupported(ctx, element) {
36
36
  }
37
37
  function layoutToken(rawText, variant, ctx) {
38
38
  const styled = applyMathVariant(rawText, variant);
39
+ const nominalAscentPt = ctx.metrics.ascentPerEm * ctx.sizePt;
40
+ const nominalDescentPt = ctx.metrics.descentPerEm * ctx.sizePt;
39
41
  let widthPt = 0;
42
+ let ascentPt = 0;
43
+ let descentPt = 0;
40
44
  let text = "";
41
45
  for (const ch of styled) {
42
46
  const codePoint = ch.codePointAt(0);
@@ -51,10 +55,10 @@ function layoutToken(rawText, variant, ctx) {
51
55
  }
52
56
  text += ch;
53
57
  widthPt += glyph.advanceWidthPt;
58
+ ascentPt = Math.max(ascentPt, glyph.inkAscentPt ?? nominalAscentPt);
59
+ descentPt = Math.max(descentPt, glyph.inkDescentPt ?? nominalDescentPt);
54
60
  }
55
61
  if (text.length === 0) return EMPTY_BOX;
56
- const ascentPt = ctx.metrics.ascentPerEm * ctx.sizePt;
57
- const descentPt = ctx.metrics.descentPerEm * ctx.sizePt;
58
62
  const items = [{
59
63
  kind: "glyphs",
60
64
  xPt: 0,
@@ -79,8 +83,63 @@ function tokenVariant(element, intrinsicDefault, ctx) {
79
83
  function miIntrinsicDefault(content) {
80
84
  return [...content].length === 1 ? "italic" : "normal";
81
85
  }
86
+ function isStretchyOperator(element) {
87
+ if (elementLocalName(element) !== "mo") return false;
88
+ if (attrValue(element, "stretchy") === "false") return false;
89
+ return operatorProperties(textContent(element).trim()).stretchy;
90
+ }
91
+ function stretchedBox(result, text, ctx) {
92
+ const axisPt = ctx.metrics.axisHeightPt;
93
+ const inkHeightPt = result.inkAscentPt + result.inkDescentPt;
94
+ const originAboveBaselinePt = axisPt - (result.inkAscentPt - result.inkDescentPt) / 2;
95
+ const ascentPt = axisPt + inkHeightPt / 2;
96
+ const descentPt = inkHeightPt / 2 - axisPt;
97
+ const items = [{
98
+ kind: "assembled-glyphs",
99
+ placements: result.placements.map((placement) => ({
100
+ glyphId: placement.glyphId,
101
+ xPt: 0,
102
+ yPt: ascentPt - originAboveBaselinePt - placement.offsetPt
103
+ })),
104
+ text,
105
+ sizePt: ctx.sizePt,
106
+ color: ctx.color
107
+ }];
108
+ return {
109
+ widthPt: result.advanceWidthPt,
110
+ ascentPt,
111
+ descentPt,
112
+ heightPt: ascentPt + descentPt,
113
+ items
114
+ };
115
+ }
116
+ function stretchOperator(element, targetSizePt, ctx) {
117
+ const text = textContent(element).trim();
118
+ const codePoints = [...text];
119
+ if (codePoints.length !== 1) return;
120
+ const codePoint = codePoints[0]?.codePointAt(0);
121
+ if (codePoint === void 0) return;
122
+ const result = ctx.metrics.stretch(codePoint, "vertical", targetSizePt, ctx.sizePt);
123
+ if (result === void 0 || result.kind === "base") return;
124
+ return stretchedBox(result, text, ctx);
125
+ }
126
+ function stretchRowOperators(children, boxes, ctx) {
127
+ const stretchy = children.map(isStretchyOperator);
128
+ if (!stretchy.includes(true)) return boxes;
129
+ const others = boxes.filter((_, index) => stretchy[index] !== true);
130
+ if (others.length === 0) return boxes;
131
+ const axisPt = ctx.metrics.axisHeightPt;
132
+ const maxAscentPt = others.reduce((max, box) => Math.max(max, box.ascentPt), 0);
133
+ const maxDescentPt = others.reduce((max, box) => Math.max(max, box.descentPt), 0);
134
+ const targetSizePt = 2 * Math.max(maxAscentPt - axisPt, maxDescentPt + axisPt);
135
+ return boxes.map((box, index) => {
136
+ if (stretchy[index] !== true) return box;
137
+ const element = children[index];
138
+ return (element === void 0 ? void 0 : stretchOperator(element, targetSizePt, ctx)) ?? box;
139
+ });
140
+ }
82
141
  function layoutRowChildren(children, ctx) {
83
- const boxes = children.map((child) => layoutNode(child, ctx));
142
+ const boxes = stretchRowOperators(children, children.map((child) => layoutNode(child, ctx)), ctx);
84
143
  const gapsPt = children.map((child, index) => {
85
144
  if (index === 0) return 0;
86
145
  const previous = children[index - 1];
@@ -3,6 +3,21 @@ interface MathGlyphMetrics {
3
3
  readonly advanceWidthPt: number;
4
4
  readonly italicCorrectionPt: number;
5
5
  readonly topAccentXPt?: number;
6
+ readonly inkAscentPt?: number;
7
+ readonly inkDescentPt?: number;
8
+ }
9
+ type MathStretchAxis = 'vertical' | 'horizontal';
10
+ interface MathStretchGlyph {
11
+ readonly glyphId: number;
12
+ readonly offsetPt: number;
13
+ }
14
+ interface MathStretchResult {
15
+ readonly kind: 'base' | 'variant' | 'assembly';
16
+ readonly sizePt: number;
17
+ readonly advanceWidthPt: number;
18
+ readonly inkAscentPt: number;
19
+ readonly inkDescentPt: number;
20
+ readonly placements: readonly MathStretchGlyph[];
6
21
  }
7
22
  interface MathFontMetrics {
8
23
  readonly ascentPerEm: number;
@@ -39,6 +54,7 @@ interface MathFontMetrics {
39
54
  readonly scriptScriptPercentScaleDown: number;
40
55
  readonly defaultRuleThicknessPt: number;
41
56
  glyph(codePoint: number, sizePt: number): MathGlyphMetrics | undefined;
57
+ stretch(codePoint: number, axis: MathStretchAxis, targetSizePt: number, sizePt: number): MathStretchResult | undefined;
42
58
  }
43
59
  //#endregion
44
- export { MathFontMetrics, MathGlyphMetrics };
60
+ export { MathFontMetrics, MathGlyphMetrics, MathStretchAxis, MathStretchGlyph, MathStretchResult };
@@ -3,6 +3,21 @@ interface MathGlyphMetrics {
3
3
  readonly advanceWidthPt: number;
4
4
  readonly italicCorrectionPt: number;
5
5
  readonly topAccentXPt?: number;
6
+ readonly inkAscentPt?: number;
7
+ readonly inkDescentPt?: number;
8
+ }
9
+ type MathStretchAxis = 'vertical' | 'horizontal';
10
+ interface MathStretchGlyph {
11
+ readonly glyphId: number;
12
+ readonly offsetPt: number;
13
+ }
14
+ interface MathStretchResult {
15
+ readonly kind: 'base' | 'variant' | 'assembly';
16
+ readonly sizePt: number;
17
+ readonly advanceWidthPt: number;
18
+ readonly inkAscentPt: number;
19
+ readonly inkDescentPt: number;
20
+ readonly placements: readonly MathStretchGlyph[];
6
21
  }
7
22
  interface MathFontMetrics {
8
23
  readonly ascentPerEm: number;
@@ -39,6 +54,7 @@ interface MathFontMetrics {
39
54
  readonly scriptScriptPercentScaleDown: number;
40
55
  readonly defaultRuleThicknessPt: number;
41
56
  glyph(codePoint: number, sizePt: number): MathGlyphMetrics | undefined;
57
+ stretch(codePoint: number, axis: MathStretchAxis, targetSizePt: number, sizePt: number): MathStretchResult | undefined;
42
58
  }
43
59
  //#endregion
44
- export { MathFontMetrics, MathGlyphMetrics };
60
+ export { MathFontMetrics, MathGlyphMetrics, MathStretchAxis, MathStretchGlyph, MathStretchResult };
@@ -51,7 +51,7 @@ function bigOperatorMovable() {
51
51
  rspaceEm: THIN_SPACE,
52
52
  largeop: true,
53
53
  movablelimits: true,
54
- stretchy: true
54
+ stretchy: false
55
55
  };
56
56
  }
57
57
  function bigOperatorFixed() {
@@ -50,7 +50,7 @@ function bigOperatorMovable() {
50
50
  rspaceEm: THIN_SPACE,
51
51
  largeop: true,
52
52
  movablelimits: true,
53
- stretchy: true
53
+ stretchy: false
54
54
  };
55
55
  }
56
56
  function bigOperatorFixed() {
@@ -1,7 +1,2 @@
1
- //#region src/mathml/variant.d.ts
2
- type MathVariant = 'normal' | 'bold' | 'italic' | 'bold-italic' | 'double-struck' | 'bold-fraktur' | 'script' | 'bold-script' | 'fraktur' | 'sans-serif' | 'bold-sans-serif' | 'sans-serif-italic' | 'sans-serif-bold-italic' | 'monospace';
3
- declare function mapMathVariant(codePoint: number, variant: MathVariant): number;
4
- declare function applyMathVariant(text: string, variant: MathVariant): string;
5
- declare function isMathVariant(value: string): value is MathVariant;
6
- //#endregion
1
+ import { i as mapMathVariant, n as applyMathVariant, r as isMathVariant, t as MathVariant } from "../variant-BMrebjMw.cjs";
7
2
  export { MathVariant, applyMathVariant, isMathVariant, mapMathVariant };
@@ -1,7 +1,2 @@
1
- //#region src/mathml/variant.d.ts
2
- type MathVariant = 'normal' | 'bold' | 'italic' | 'bold-italic' | 'double-struck' | 'bold-fraktur' | 'script' | 'bold-script' | 'fraktur' | 'sans-serif' | 'bold-sans-serif' | 'sans-serif-italic' | 'sans-serif-bold-italic' | 'monospace';
3
- declare function mapMathVariant(codePoint: number, variant: MathVariant): number;
4
- declare function applyMathVariant(text: string, variant: MathVariant): string;
5
- declare function isMathVariant(value: string): value is MathVariant;
6
- //#endregion
1
+ import { i as mapMathVariant, n as applyMathVariant, r as isMathVariant, t as MathVariant } from "../variant-BMrebjMw.js";
7
2
  export { MathVariant, applyMathVariant, isMathVariant, mapMathVariant };
@@ -1,4 +1,4 @@
1
- import { HsqldbTable } from "../hsqldb/script.cjs";
1
+ import { r as HsqldbTable } from "../script-DsGGIzGU.cjs";
2
2
  //#region src/odb/csv.d.ts
3
3
  declare class OdbTableNotSpecifiedError extends Error {
4
4
  readonly availableTables: readonly string[];
package/dist/odb/csv.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { HsqldbTable } from "../hsqldb/script.js";
1
+ import { r as HsqldbTable } from "../script-DsGGIzGU.js";
2
2
  //#region src/odb/csv.d.ts
3
3
  declare class OdbTableNotSpecifiedError extends Error {
4
4
  readonly availableTables: readonly string[];
@@ -0,0 +1,49 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_odb_formula_errors = require("./errors.cjs");
3
+ //#region src/odb/formula/definition.ts
4
+ function rptBandDefinition(band) {
5
+ return { formulas: band.elements.map((element) => element.formula) };
6
+ }
7
+ function bandDefinition(band) {
8
+ return band === void 0 ? void 0 : rptBandDefinition(band);
9
+ }
10
+ function odbReportGroupChain(report) {
11
+ const chain = [];
12
+ let level = report.groups;
13
+ while (level.length > 0) {
14
+ if (level.length > 1) throw new require_odb_formula_errors.RptReportStructureError(`${String(level.length)} sibling groups are declared at one nesting level, but Report Builder nests groups strictly and this engine's scoping is defined only for a chain`, report.name);
15
+ const group = level[0];
16
+ if (group === void 0) throw new require_odb_formula_errors.RptReportStructureError("a group nesting level reported a non-zero length but held no group", report.name);
17
+ chain.push(group);
18
+ level = group.groups;
19
+ }
20
+ return chain;
21
+ }
22
+ function groupDefinition(group, level, reportName) {
23
+ if (group.groupExpression === void 0) throw new require_odb_formula_errors.RptReportStructureError(`the group at nesting level ${String(level)} declares no rpt:group-expression, so there is no break test to evaluate`, reportName);
24
+ return {
25
+ groupExpression: group.groupExpression,
26
+ functions: group.functions.map((declaration) => ({
27
+ name: declaration.name,
28
+ formula: declaration.formula
29
+ })),
30
+ header: bandDefinition(group.header),
31
+ footer: bandDefinition(group.footer)
32
+ };
33
+ }
34
+ function rptDefinitionFromReport(report) {
35
+ return {
36
+ functions: report.functions.map((declaration) => ({
37
+ name: declaration.name,
38
+ formula: declaration.formula
39
+ })),
40
+ reportHeader: bandDefinition(report.reportHeader),
41
+ groups: odbReportGroupChain(report).map((group, level) => groupDefinition(group, level, report.name)),
42
+ detail: bandDefinition(report.detail),
43
+ reportFooter: bandDefinition(report.reportFooter)
44
+ };
45
+ }
46
+ //#endregion
47
+ exports.odbReportGroupChain = odbReportGroupChain;
48
+ exports.rptBandDefinition = rptBandDefinition;
49
+ exports.rptDefinitionFromReport = rptDefinitionFromReport;
@@ -0,0 +1,8 @@
1
+ import { RptBandDefinition, RptReportDefinition } from "./evaluate.cjs";
2
+ import { OdbReport, OdbReportBand, OdbReportGroup } from "odf.js";
3
+ //#region src/odb/formula/definition.d.ts
4
+ declare function rptBandDefinition(band: OdbReportBand): RptBandDefinition;
5
+ declare function odbReportGroupChain(report: OdbReport): readonly OdbReportGroup[];
6
+ declare function rptDefinitionFromReport(report: OdbReport): RptReportDefinition;
7
+ //#endregion
8
+ export { odbReportGroupChain, rptBandDefinition, rptDefinitionFromReport };
@@ -0,0 +1,8 @@
1
+ import { RptBandDefinition, RptReportDefinition } from "./evaluate.js";
2
+ import { OdbReport, OdbReportBand, OdbReportGroup } from "odf.js";
3
+ //#region src/odb/formula/definition.d.ts
4
+ declare function rptBandDefinition(band: OdbReportBand): RptBandDefinition;
5
+ declare function odbReportGroupChain(report: OdbReport): readonly OdbReportGroup[];
6
+ declare function rptDefinitionFromReport(report: OdbReport): RptReportDefinition;
7
+ //#endregion
8
+ export { odbReportGroupChain, rptBandDefinition, rptDefinitionFromReport };
@@ -0,0 +1,46 @@
1
+ import { RptReportStructureError } from "./errors.js";
2
+ //#region src/odb/formula/definition.ts
3
+ function rptBandDefinition(band) {
4
+ return { formulas: band.elements.map((element) => element.formula) };
5
+ }
6
+ function bandDefinition(band) {
7
+ return band === void 0 ? void 0 : rptBandDefinition(band);
8
+ }
9
+ function odbReportGroupChain(report) {
10
+ const chain = [];
11
+ let level = report.groups;
12
+ while (level.length > 0) {
13
+ if (level.length > 1) throw new RptReportStructureError(`${String(level.length)} sibling groups are declared at one nesting level, but Report Builder nests groups strictly and this engine's scoping is defined only for a chain`, report.name);
14
+ const group = level[0];
15
+ if (group === void 0) throw new RptReportStructureError("a group nesting level reported a non-zero length but held no group", report.name);
16
+ chain.push(group);
17
+ level = group.groups;
18
+ }
19
+ return chain;
20
+ }
21
+ function groupDefinition(group, level, reportName) {
22
+ if (group.groupExpression === void 0) throw new RptReportStructureError(`the group at nesting level ${String(level)} declares no rpt:group-expression, so there is no break test to evaluate`, reportName);
23
+ return {
24
+ groupExpression: group.groupExpression,
25
+ functions: group.functions.map((declaration) => ({
26
+ name: declaration.name,
27
+ formula: declaration.formula
28
+ })),
29
+ header: bandDefinition(group.header),
30
+ footer: bandDefinition(group.footer)
31
+ };
32
+ }
33
+ function rptDefinitionFromReport(report) {
34
+ return {
35
+ functions: report.functions.map((declaration) => ({
36
+ name: declaration.name,
37
+ formula: declaration.formula
38
+ })),
39
+ reportHeader: bandDefinition(report.reportHeader),
40
+ groups: odbReportGroupChain(report).map((group, level) => groupDefinition(group, level, report.name)),
41
+ detail: bandDefinition(report.detail),
42
+ reportFooter: bandDefinition(report.reportFooter)
43
+ };
44
+ }
45
+ //#endregion
46
+ export { odbReportGroupChain, rptBandDefinition, rptDefinitionFromReport };
@@ -0,0 +1,47 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/odb/formula/errors.ts
3
+ const MESSAGE_FORMULA_PREVIEW_LENGTH = 200;
4
+ function truncateForMessage(formula) {
5
+ return formula.length > MESSAGE_FORMULA_PREVIEW_LENGTH ? `${formula.slice(0, MESSAGE_FORMULA_PREVIEW_LENGTH)}...` : formula;
6
+ }
7
+ var RptFormulaUnsupportedError = class extends Error {
8
+ functionName;
9
+ formula;
10
+ constructor(functionName, formula) {
11
+ super(`Report Builder formula: rpt:${functionName} is not supported by this bounded formula engine -- supported functions are HASCHANGED, LEFT, SUM, COUNT, AVG, MIN, MAX -- in formula: ${truncateForMessage(formula)}`);
12
+ this.name = "RptFormulaUnsupportedError";
13
+ this.functionName = functionName;
14
+ this.formula = formula;
15
+ }
16
+ };
17
+ var RptFormulaParseError = class extends Error {
18
+ formula;
19
+ offset;
20
+ constructor(message, formula, offset) {
21
+ super(`Report Builder formula parse error at offset ${String(offset)}: ${message} -- in formula: ${truncateForMessage(formula)}`);
22
+ this.name = "RptFormulaParseError";
23
+ this.formula = formula;
24
+ this.offset = offset;
25
+ }
26
+ };
27
+ var RptFormulaEvaluationError = class extends Error {
28
+ formula;
29
+ constructor(message, formula) {
30
+ super(`Report Builder formula evaluation error: ${message} -- in formula: ${truncateForMessage(formula)}`);
31
+ this.name = "RptFormulaEvaluationError";
32
+ this.formula = formula;
33
+ }
34
+ };
35
+ var RptReportStructureError = class extends Error {
36
+ reportName;
37
+ constructor(message, reportName) {
38
+ super(`Report Builder report structure error in report "${reportName}": ${message}`);
39
+ this.name = "RptReportStructureError";
40
+ this.reportName = reportName;
41
+ }
42
+ };
43
+ //#endregion
44
+ exports.RptFormulaEvaluationError = RptFormulaEvaluationError;
45
+ exports.RptFormulaParseError = RptFormulaParseError;
46
+ exports.RptFormulaUnsupportedError = RptFormulaUnsupportedError;
47
+ exports.RptReportStructureError = RptReportStructureError;
@@ -0,0 +1,21 @@
1
+ //#region src/odb/formula/errors.d.ts
2
+ declare class RptFormulaUnsupportedError extends Error {
3
+ readonly functionName: string;
4
+ readonly formula: string;
5
+ constructor(functionName: string, formula: string);
6
+ }
7
+ declare class RptFormulaParseError extends Error {
8
+ readonly formula: string;
9
+ readonly offset: number;
10
+ constructor(message: string, formula: string, offset: number);
11
+ }
12
+ declare class RptFormulaEvaluationError extends Error {
13
+ readonly formula: string;
14
+ constructor(message: string, formula: string);
15
+ }
16
+ declare class RptReportStructureError extends Error {
17
+ readonly reportName: string;
18
+ constructor(message: string, reportName: string);
19
+ }
20
+ //#endregion
21
+ export { RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, RptReportStructureError };
@@ -0,0 +1,21 @@
1
+ //#region src/odb/formula/errors.d.ts
2
+ declare class RptFormulaUnsupportedError extends Error {
3
+ readonly functionName: string;
4
+ readonly formula: string;
5
+ constructor(functionName: string, formula: string);
6
+ }
7
+ declare class RptFormulaParseError extends Error {
8
+ readonly formula: string;
9
+ readonly offset: number;
10
+ constructor(message: string, formula: string, offset: number);
11
+ }
12
+ declare class RptFormulaEvaluationError extends Error {
13
+ readonly formula: string;
14
+ constructor(message: string, formula: string);
15
+ }
16
+ declare class RptReportStructureError extends Error {
17
+ readonly reportName: string;
18
+ constructor(message: string, reportName: string);
19
+ }
20
+ //#endregion
21
+ export { RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, RptReportStructureError };
@@ -0,0 +1,43 @@
1
+ //#region src/odb/formula/errors.ts
2
+ const MESSAGE_FORMULA_PREVIEW_LENGTH = 200;
3
+ function truncateForMessage(formula) {
4
+ return formula.length > MESSAGE_FORMULA_PREVIEW_LENGTH ? `${formula.slice(0, MESSAGE_FORMULA_PREVIEW_LENGTH)}...` : formula;
5
+ }
6
+ var RptFormulaUnsupportedError = class extends Error {
7
+ functionName;
8
+ formula;
9
+ constructor(functionName, formula) {
10
+ super(`Report Builder formula: rpt:${functionName} is not supported by this bounded formula engine -- supported functions are HASCHANGED, LEFT, SUM, COUNT, AVG, MIN, MAX -- in formula: ${truncateForMessage(formula)}`);
11
+ this.name = "RptFormulaUnsupportedError";
12
+ this.functionName = functionName;
13
+ this.formula = formula;
14
+ }
15
+ };
16
+ var RptFormulaParseError = class extends Error {
17
+ formula;
18
+ offset;
19
+ constructor(message, formula, offset) {
20
+ super(`Report Builder formula parse error at offset ${String(offset)}: ${message} -- in formula: ${truncateForMessage(formula)}`);
21
+ this.name = "RptFormulaParseError";
22
+ this.formula = formula;
23
+ this.offset = offset;
24
+ }
25
+ };
26
+ var RptFormulaEvaluationError = class extends Error {
27
+ formula;
28
+ constructor(message, formula) {
29
+ super(`Report Builder formula evaluation error: ${message} -- in formula: ${truncateForMessage(formula)}`);
30
+ this.name = "RptFormulaEvaluationError";
31
+ this.formula = formula;
32
+ }
33
+ };
34
+ var RptReportStructureError = class extends Error {
35
+ reportName;
36
+ constructor(message, reportName) {
37
+ super(`Report Builder report structure error in report "${reportName}": ${message}`);
38
+ this.name = "RptReportStructureError";
39
+ this.reportName = reportName;
40
+ }
41
+ };
42
+ //#endregion
43
+ export { RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, RptReportStructureError };