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.
- package/README.md +124 -25
- package/dist/convert/convert.cjs +3 -3
- package/dist/convert/convert.d.cts +5 -2
- package/dist/convert/convert.d.ts +4 -1
- package/dist/convert/convert.js +3 -3
- package/dist/edit/docx/content.d.cts +1 -1
- package/dist/edit/docx/content.d.ts +1 -1
- package/dist/edit/docx/paragraph.d.cts +3 -3
- package/dist/edit/docx/paragraph.d.ts +3 -3
- package/dist/edit/ods/address.cjs +42 -24
- package/dist/edit/ods/address.d.cts +12 -2
- package/dist/edit/ods/address.d.ts +12 -2
- package/dist/edit/ods/address.js +39 -25
- package/dist/edit/ods/column-row.cjs +68 -6
- package/dist/edit/ods/column-row.d.cts +5 -1
- package/dist/edit/ods/column-row.d.ts +5 -1
- package/dist/edit/ods/column-row.js +68 -10
- package/dist/edit/ods/content.cjs +10 -2
- package/dist/edit/ods/content.js +10 -2
- package/dist/edit/ods/floating.cjs +90 -0
- package/dist/edit/ods/floating.d.cts +7 -0
- package/dist/edit/ods/floating.d.ts +7 -0
- package/dist/edit/ods/floating.js +88 -0
- package/dist/edit/ods/print-settings.cjs +158 -2
- package/dist/edit/ods/print-settings.js +159 -3
- package/dist/edit/ods/sheet.cjs +13 -0
- package/dist/edit/ods/sheet.d.cts +5 -1
- package/dist/edit/ods/sheet.d.ts +5 -1
- package/dist/edit/ods/sheet.js +14 -1
- package/dist/edit/odt/content.cjs +8 -4
- package/dist/edit/odt/content.js +8 -4
- package/dist/edit/odt/editor.cjs +7 -0
- package/dist/edit/odt/editor.d.cts +3 -0
- package/dist/edit/odt/editor.d.ts +3 -0
- package/dist/edit/odt/editor.js +7 -0
- package/dist/edit/odt/formula.cjs +19 -0
- package/dist/edit/odt/formula.d.cts +8 -0
- package/dist/edit/odt/formula.d.ts +8 -0
- package/dist/edit/odt/formula.js +17 -0
- package/dist/evaluate-BU5N1Jk1.d.ts +11 -0
- package/dist/evaluate-BhMXY6DM.d.cts +11 -0
- package/dist/firebird/backup.d.cts +1 -1
- package/dist/firebird/backup.d.ts +1 -1
- package/dist/firebird/data.cjs +30 -16
- package/dist/firebird/data.d.cts +3 -2
- package/dist/firebird/data.d.ts +3 -2
- package/dist/firebird/data.js +30 -17
- package/dist/fonts/ooxml.d.cts +1 -1
- package/dist/fonts/registry.d.cts +1 -1
- package/dist/formula-CgydMiTt.d.ts +10 -0
- package/dist/formula-CiwPw8nY.d.cts +10 -0
- package/dist/hsqldb/binary-script.d.cts +1 -1
- package/dist/hsqldb/binary-script.d.ts +1 -1
- package/dist/hsqldb/cache.d.cts +1 -1
- package/dist/hsqldb/cache.d.ts +1 -1
- package/dist/hsqldb/rowformat.cjs +22 -13
- package/dist/hsqldb/rowformat.js +22 -13
- package/dist/hsqldb/script.d.cts +1 -18
- package/dist/hsqldb/script.d.ts +1 -18
- package/dist/index.cjs +56 -0
- package/dist/index.d.cts +24 -10
- package/dist/index.d.ts +23 -9
- package/dist/index.js +15 -2
- package/dist/layout/sheets.cjs +30 -24
- package/dist/layout/sheets.js +31 -25
- package/dist/layout/slides.cjs +6 -4
- package/dist/layout/slides.js +7 -5
- package/dist/lexer-DGPWx_f2.d.cts +42 -0
- package/dist/lexer-DGPWx_f2.d.ts +42 -0
- package/dist/mathml/compose.cjs +8 -0
- package/dist/mathml/compose.js +8 -0
- package/dist/mathml/layout-types.d.cts +14 -2
- package/dist/mathml/layout-types.d.ts +14 -2
- package/dist/mathml/layout.cjs +62 -3
- package/dist/mathml/layout.d.cts +1 -1
- package/dist/mathml/layout.d.ts +1 -1
- package/dist/mathml/layout.js +62 -3
- package/dist/mathml/metrics.d.cts +17 -1
- package/dist/mathml/metrics.d.ts +17 -1
- package/dist/mathml/operators.cjs +1 -1
- package/dist/mathml/operators.js +1 -1
- package/dist/mathml/variant.d.cts +1 -6
- package/dist/mathml/variant.d.ts +1 -6
- package/dist/odb/csv.d.cts +1 -1
- package/dist/odb/csv.d.ts +1 -1
- package/dist/odb/formula/definition.cjs +49 -0
- package/dist/odb/formula/definition.d.cts +8 -0
- package/dist/odb/formula/definition.d.ts +8 -0
- package/dist/odb/formula/definition.js +46 -0
- package/dist/odb/formula/errors.cjs +47 -0
- package/dist/odb/formula/errors.d.cts +21 -0
- package/dist/odb/formula/errors.d.ts +21 -0
- package/dist/odb/formula/errors.js +43 -0
- package/dist/odb/formula/evaluate.cjs +283 -0
- package/dist/odb/formula/evaluate.d.cts +43 -0
- package/dist/odb/formula/evaluate.d.ts +43 -0
- package/dist/odb/formula/evaluate.js +281 -0
- package/dist/odb/formula/parser.cjs +198 -0
- package/dist/odb/formula/parser.d.cts +29 -0
- package/dist/odb/formula/parser.d.ts +29 -0
- package/dist/odb/formula/parser.js +197 -0
- package/dist/odb/read.d.cts +1 -1
- package/dist/odb/read.d.ts +1 -1
- package/dist/odb/report/content.cjs +27 -0
- package/dist/odb/report/content.d.cts +14 -0
- package/dist/odb/report/content.d.ts +14 -0
- package/dist/odb/report/content.js +25 -0
- package/dist/odb/report/render.cjs +106 -0
- package/dist/odb/report/render.d.cts +7 -0
- package/dist/odb/report/render.d.ts +7 -0
- package/dist/odb/report/render.js +106 -0
- package/dist/odb/report/source.cjs +45 -0
- package/dist/odb/report/source.d.cts +14 -0
- package/dist/odb/report/source.d.ts +14 -0
- package/dist/odb/report/source.js +42 -0
- package/dist/odb/spreadsheet.d.cts +1 -1
- package/dist/odb/spreadsheet.d.ts +1 -1
- package/dist/odb/sql/errors.cjs +38 -0
- package/dist/odb/sql/errors.d.cts +17 -0
- package/dist/odb/sql/errors.d.ts +17 -0
- package/dist/odb/sql/errors.js +35 -0
- package/dist/odb/sql/evaluate.cjs +312 -0
- package/dist/odb/sql/evaluate.d.cts +2 -0
- package/dist/odb/sql/evaluate.d.ts +2 -0
- package/dist/odb/sql/evaluate.js +311 -0
- package/dist/odb/sql/lexer.cjs +282 -0
- package/dist/odb/sql/lexer.d.cts +2 -0
- package/dist/odb/sql/lexer.d.ts +2 -0
- package/dist/odb/sql/lexer.js +281 -0
- package/dist/odb/sql/parser.cjs +479 -0
- package/dist/odb/sql/parser.d.cts +2 -0
- package/dist/odb/sql/parser.d.ts +2 -0
- package/dist/odb/sql/parser.js +478 -0
- package/dist/odb/values.cjs +75 -0
- package/dist/odb/values.d.cts +2 -0
- package/dist/odb/values.d.ts +2 -0
- package/dist/odb/values.js +69 -0
- package/dist/odf/odt/read.cjs +43 -21
- package/dist/odf/odt/read.js +43 -21
- package/dist/odf-package/formula.cjs +59 -0
- package/dist/odf-package/formula.d.cts +11 -0
- package/dist/odf-package/formula.d.ts +11 -0
- package/dist/odf-package/formula.js +58 -0
- package/dist/odf-package/manifest.cjs +29 -0
- package/dist/odf-package/manifest.d.cts +5 -2
- package/dist/odf-package/manifest.d.ts +5 -2
- package/dist/odf-package/manifest.js +30 -2
- package/dist/odf-package/media.cjs +2 -1
- package/dist/odf-package/media.js +2 -2
- package/dist/omml/read.cjs +265 -0
- package/dist/omml/read.d.cts +12 -0
- package/dist/omml/read.d.ts +12 -0
- package/dist/omml/read.js +263 -0
- package/dist/omml/shared.cjs +67 -0
- package/dist/omml/shared.d.cts +2 -0
- package/dist/omml/shared.d.ts +2 -0
- package/dist/omml/shared.js +64 -0
- package/dist/omml/write.cjs +3 -51
- package/dist/omml/write.d.cts +2 -2
- package/dist/omml/write.d.ts +2 -2
- package/dist/omml/write.js +1 -49
- package/dist/ooxml/docx/extras.cjs +15 -0
- package/dist/ooxml/docx/extras.d.cts +12 -0
- package/dist/ooxml/docx/extras.d.ts +12 -0
- package/dist/ooxml/docx/extras.js +14 -0
- package/dist/ooxml/docx/formula.cjs +109 -0
- package/dist/ooxml/docx/formula.d.cts +2 -0
- package/dist/ooxml/docx/formula.d.ts +2 -0
- package/dist/ooxml/docx/formula.js +108 -0
- package/dist/ooxml/docx/read.cjs +10 -2
- package/dist/ooxml/docx/read.d.cts +6 -2
- package/dist/ooxml/docx/read.d.ts +6 -2
- package/dist/ooxml/docx/read.js +11 -3
- package/dist/parser-B9vC1T6T.d.cts +101 -0
- package/dist/parser-DQSgYJzQ.d.ts +101 -0
- package/dist/{registry-CtPhMD0f.d.cts → registry-lqJej0Jr.d.cts} +1 -1
- package/dist/script-DsGGIzGU.d.cts +19 -0
- package/dist/script-DsGGIzGU.d.ts +19 -0
- package/dist/shared-DLZ3IQUl.d.cts +15 -0
- package/dist/shared-DUOzjwcL.d.ts +15 -0
- package/dist/values-BetetbaH.d.cts +23 -0
- package/dist/values-BetetbaH.d.ts +23 -0
- package/dist/variant-BMrebjMw.d.cts +7 -0
- package/dist/variant-BMrebjMw.d.ts +7 -0
- package/dist/{write-DuyfnbL_.d.cts → write-BQ6SK8r8.d.cts} +2 -6
- package/dist/{write-Zqwx6pka.d.ts → write-THs7ipBq.d.ts} +2 -6
- package/package.json +2 -2
package/dist/mathml/layout.cjs
CHANGED
|
@@ -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];
|
package/dist/mathml/layout.d.cts
CHANGED
|
@@ -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;
|
package/dist/mathml/layout.d.ts
CHANGED
|
@@ -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;
|
package/dist/mathml/layout.js
CHANGED
|
@@ -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 };
|
package/dist/mathml/metrics.d.ts
CHANGED
|
@@ -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 };
|
package/dist/mathml/operators.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
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 };
|
package/dist/mathml/variant.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
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 };
|
package/dist/odb/csv.d.cts
CHANGED
package/dist/odb/csv.d.ts
CHANGED
|
@@ -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 };
|