documents.js 1.60.3 → 1.62.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 +84 -44
- package/dist/{blr-types-CYYC3yYU.d.cts → blr-types-DVgO1DQ9.d.cts} +1 -1
- package/dist/{blr-types-CYYC3yYU.d.ts → blr-types-DVgO1DQ9.d.ts} +1 -1
- package/dist/convert/capability.cjs +1 -0
- package/dist/convert/capability.d.cts +1 -1
- package/dist/convert/capability.d.ts +1 -1
- package/dist/convert/capability.js +1 -0
- package/dist/convert/convert.cjs +29 -27
- package/dist/convert/convert.d.cts +9 -3
- package/dist/convert/convert.d.ts +9 -3
- package/dist/convert/convert.js +29 -27
- package/dist/edit/docx/content.cjs +75 -13
- package/dist/edit/docx/content.d.cts +8 -2
- package/dist/edit/docx/content.d.ts +8 -2
- package/dist/edit/docx/content.js +75 -13
- package/dist/edit/docx/paragraph.cjs +14 -0
- package/dist/edit/docx/paragraph.d.cts +5 -0
- package/dist/edit/docx/paragraph.d.ts +5 -0
- package/dist/edit/docx/paragraph.js +14 -0
- package/dist/edit/docx/run.cjs +1 -1
- package/dist/edit/docx/run.js +1 -1
- package/dist/edit/docx/table.cjs +41 -0
- package/dist/edit/docx/table.d.cts +7 -1
- package/dist/edit/docx/table.d.ts +7 -1
- package/dist/edit/docx/table.js +42 -1
- package/dist/edit/geometry.cjs +38 -0
- package/dist/edit/geometry.d.cts +7 -0
- package/dist/edit/geometry.d.ts +7 -0
- package/dist/edit/geometry.js +36 -0
- package/dist/edit/odg/content.cjs +15 -12
- package/dist/edit/odg/content.js +15 -12
- package/dist/edit/odg/editor.d.cts +1 -1
- package/dist/edit/odg/editor.d.ts +1 -1
- package/dist/edit/odg/page.d.cts +3 -3
- package/dist/edit/odg/page.d.ts +3 -3
- package/dist/edit/odg/vector.cjs +22 -13
- package/dist/edit/odg/vector.d.cts +1 -1
- package/dist/edit/odg/vector.d.ts +1 -1
- package/dist/edit/odg/vector.js +23 -14
- package/dist/edit/odp/content.cjs +15 -0
- package/dist/edit/odp/content.js +16 -1
- package/dist/edit/odp/editor.d.cts +1 -1
- package/dist/edit/odp/editor.d.ts +1 -1
- package/dist/edit/odp/image.d.cts +1 -1
- package/dist/edit/odp/image.d.ts +1 -1
- package/dist/edit/odp/shape.cjs +11 -30
- package/dist/edit/odp/shape.d.cts +2 -2
- package/dist/edit/odp/shape.d.ts +2 -2
- package/dist/edit/odp/shape.js +13 -33
- package/dist/edit/odp/slide.cjs +11 -0
- package/dist/edit/odp/slide.d.cts +14 -4
- package/dist/edit/odp/slide.d.ts +14 -4
- package/dist/edit/odp/slide.js +12 -1
- package/dist/edit/odt/content.cjs +56 -16
- package/dist/edit/odt/content.d.cts +4 -2
- package/dist/edit/odt/content.d.ts +4 -2
- package/dist/edit/odt/content.js +56 -17
- package/dist/edit/odt/editor.d.cts +1 -1
- package/dist/edit/odt/editor.d.ts +1 -1
- package/dist/edit/odt/table.cjs +36 -0
- package/dist/edit/odt/table.d.cts +1 -36
- package/dist/edit/odt/table.d.ts +1 -36
- package/dist/edit/odt/table.js +37 -1
- package/dist/edit/pptx/content.cjs +71 -3
- package/dist/edit/pptx/content.js +71 -3
- package/dist/edit/pptx/editor.d.cts +1 -1
- package/dist/edit/pptx/editor.d.ts +1 -1
- package/dist/edit/pptx/image.d.cts +1 -1
- package/dist/edit/pptx/image.d.ts +1 -1
- package/dist/edit/pptx/shape.cjs +23 -1
- package/dist/edit/pptx/shape.d.cts +2 -2
- package/dist/edit/pptx/shape.d.ts +2 -2
- package/dist/edit/pptx/shape.js +23 -3
- package/dist/edit/pptx/slide.cjs +10 -1
- package/dist/edit/pptx/slide.d.cts +11 -4
- package/dist/edit/pptx/slide.d.ts +11 -4
- package/dist/edit/pptx/slide.js +10 -1
- package/dist/edit/pptx/table.cjs +136 -0
- package/dist/edit/pptx/table.d.cts +2 -0
- package/dist/edit/pptx/table.d.ts +2 -0
- package/dist/edit/pptx/table.js +131 -0
- package/dist/firebird/backup.d.cts +1 -1
- package/dist/firebird/backup.d.ts +1 -1
- package/dist/firebird/blr-types.cjs +2 -2
- package/dist/firebird/blr-types.d.cts +1 -1
- package/dist/firebird/blr-types.d.ts +1 -1
- package/dist/firebird/blr-types.js +2 -2
- package/dist/firebird/data.cjs +68 -14
- package/dist/firebird/data.d.cts +1 -1
- package/dist/firebird/data.d.ts +1 -1
- package/dist/firebird/data.js +68 -14
- package/dist/firebird/schema.cjs +13 -1
- package/dist/firebird/schema.d.cts +1 -1
- package/dist/firebird/schema.d.ts +1 -1
- package/dist/firebird/schema.js +13 -1
- package/dist/{geometry-DvwdrIij.d.cts → geometry-DaJr8yQW.d.cts} +2 -2
- package/dist/{geometry-DvwdrIij.d.ts → geometry-DaJr8yQW.d.ts} +2 -2
- package/dist/hsqldb/binary-script.cjs +154 -0
- package/dist/hsqldb/binary-script.d.cts +15 -0
- package/dist/hsqldb/binary-script.d.ts +15 -0
- package/dist/hsqldb/binary-script.js +151 -0
- package/dist/hsqldb/cache.cjs +18 -11
- package/dist/hsqldb/cache.d.cts +9 -4
- package/dist/hsqldb/cache.d.ts +9 -4
- package/dist/hsqldb/cache.js +18 -11
- package/dist/hsqldb/rowformat.cjs +60 -16
- package/dist/hsqldb/rowformat.d.cts +2 -21
- package/dist/hsqldb/rowformat.d.ts +2 -21
- package/dist/hsqldb/rowformat.js +60 -17
- package/dist/{image-BZDy72Jb.d.cts → image-7snmKIxn.d.cts} +1 -1
- package/dist/{image-B-xQWYYS.d.ts → image-Cs8xF753.d.ts} +1 -1
- package/dist/{image-CeqwL-Qs.d.ts → image-DHcA9kaK.d.ts} +1 -1
- package/dist/{image-DWX6cNOD.d.cts → image-M5SezZVI.d.cts} +1 -1
- package/dist/index.cjs +54 -3
- package/dist/index.d.cts +28 -20
- package/dist/index.d.ts +27 -19
- package/dist/index.js +13 -4
- package/dist/layout/cell-typing.cjs +209 -0
- package/dist/layout/cell-typing.d.cts +22 -0
- package/dist/layout/cell-typing.d.ts +22 -0
- package/dist/layout/cell-typing.js +208 -0
- package/dist/layout/drawing.cjs +193 -17
- package/dist/layout/drawing.js +193 -17
- package/dist/layout/engine.cjs +46 -29
- package/dist/layout/engine.d.cts +0 -2
- package/dist/layout/engine.d.ts +0 -2
- package/dist/layout/engine.js +47 -30
- package/dist/layout/lattice.cjs +139 -0
- package/dist/layout/lattice.d.cts +20 -0
- package/dist/layout/lattice.d.ts +20 -0
- package/dist/layout/lattice.js +135 -0
- package/dist/layout/reconstruct.cjs +176 -113
- package/dist/layout/reconstruct.d.cts +2 -0
- package/dist/layout/reconstruct.d.ts +2 -0
- package/dist/layout/reconstruct.js +173 -110
- package/dist/layout/shared.cjs +52 -0
- package/dist/layout/shared.d.cts +4 -2
- package/dist/layout/shared.d.ts +4 -2
- package/dist/layout/shared.js +51 -1
- package/dist/layout/sheets.cjs +45 -11
- package/dist/layout/sheets.js +46 -12
- package/dist/layout/slides.cjs +7 -7
- package/dist/layout/slides.d.cts +0 -3
- package/dist/layout/slides.d.ts +0 -3
- package/dist/layout/slides.js +7 -7
- package/dist/markdown/write.cjs +19 -6
- package/dist/markdown/write.js +19 -6
- package/dist/mathml/layout.cjs +43 -9
- package/dist/mathml/layout.d.cts +1 -1
- package/dist/mathml/layout.d.ts +1 -1
- package/dist/mathml/layout.js +43 -9
- package/dist/mathml/variant.cjs +48 -5
- package/dist/mathml/variant.js +48 -5
- package/dist/model/embedded-drawing.cjs +32 -0
- package/dist/model/embedded-drawing.d.cts +8 -0
- package/dist/model/embedded-drawing.d.ts +8 -0
- package/dist/model/embedded-drawing.js +30 -0
- package/dist/model/formula.cjs +31 -0
- package/dist/model/formula.d.cts +6 -6
- package/dist/model/formula.d.ts +6 -6
- package/dist/model/formula.js +27 -0
- package/dist/model/geometry.d.cts +1 -1
- package/dist/model/geometry.d.ts +1 -1
- package/dist/model/paint-order.cjs +15 -0
- package/dist/model/paint-order.d.cts +14 -0
- package/dist/model/paint-order.d.ts +14 -0
- package/dist/model/paint-order.js +14 -0
- package/dist/odb/components.cjs +12 -0
- package/dist/odb/components.d.cts +6 -0
- package/dist/odb/components.d.ts +6 -0
- package/dist/odb/components.js +10 -0
- package/dist/odb/read.cjs +11 -7
- package/dist/odb/read.d.cts +3 -2
- package/dist/odb/read.d.ts +3 -2
- package/dist/odb/read.js +11 -7
- package/dist/odf/formula/detect.cjs +86 -18
- package/dist/odf/formula/detect.d.cts +10 -6
- package/dist/odf/formula/detect.d.ts +10 -6
- package/dist/odf/formula/detect.js +86 -19
- package/dist/odf/formula/read.cjs +4 -16
- package/dist/odf/formula/read.d.cts +4 -8
- package/dist/odf/formula/read.d.ts +4 -8
- package/dist/odf/formula/read.js +5 -17
- package/dist/odf/odp/read.cjs +9 -19
- package/dist/odf/odp/read.d.cts +2 -7
- package/dist/odf/odp/read.d.ts +2 -7
- package/dist/odf/odp/read.js +10 -20
- package/dist/odf/odt/read.cjs +63 -23
- package/dist/odf/odt/read.d.cts +2 -7
- package/dist/odf/odt/read.d.ts +2 -7
- package/dist/odf/odt/read.js +64 -24
- package/dist/omml/write.cjs +258 -0
- package/dist/omml/write.d.cts +2 -0
- package/dist/omml/write.d.ts +2 -0
- package/dist/omml/write.js +256 -0
- package/dist/rowformat-Cl2exlEh.d.cts +25 -0
- package/dist/rowformat-Cl2exlEh.d.ts +25 -0
- package/dist/{schema-Acco3Ezi.d.cts → schema-BeR_KJ0X.d.cts} +3 -1
- package/dist/{schema-VkAA6pF5.d.ts → schema-CSKwSb_v.d.ts} +3 -1
- package/dist/{shape-BUfjw5eZ.d.cts → shape-BhkP6HB8.d.cts} +6 -2
- package/dist/{shape-CTkl6kt8.d.ts → shape-BkVcwPcf.d.ts} +6 -2
- package/dist/{shape-BfN3m52m.d.ts → shape-CVXedeL7.d.ts} +3 -2
- package/dist/{shape-CN2ycxOo.d.cts → shape-CXZ6fejV.d.cts} +3 -2
- package/dist/table-C3CPZ--2.d.cts +35 -0
- package/dist/table-DjYcNOFm.d.cts +44 -0
- package/dist/table-DqfqMkVq.d.ts +44 -0
- package/dist/table-DvS_7UQS.d.ts +35 -0
- package/dist/{vector-ClohqsOe.d.cts → vector-Puuqu_IT.d.cts} +4 -0
- package/dist/{vector-ClohqsOe.d.ts → vector-Puuqu_IT.d.ts} +4 -0
- package/dist/write-DuyfnbL_.d.cts +16 -0
- package/dist/write-Zqwx6pka.d.ts +16 -0
- package/package.json +4 -4
- package/dist/odf/formula/placeholder.cjs +0 -36
- package/dist/odf/formula/placeholder.d.cts +0 -14
- package/dist/odf/formula/placeholder.d.ts +0 -14
- package/dist/odf/formula/placeholder.js +0 -36
package/dist/mathml/variant.js
CHANGED
|
@@ -823,7 +823,13 @@ const GREEK_VARIANTS = {
|
|
|
823
823
|
120538
|
|
824
824
|
],
|
|
825
825
|
nabla: 120513,
|
|
826
|
-
partial: 120539
|
|
826
|
+
partial: 120539,
|
|
827
|
+
epsilon: 120540,
|
|
828
|
+
theta: 120541,
|
|
829
|
+
kappa: 120542,
|
|
830
|
+
phi: 120543,
|
|
831
|
+
rho: 120544,
|
|
832
|
+
pi: 120545
|
|
827
833
|
},
|
|
828
834
|
italic: {
|
|
829
835
|
upper: [
|
|
@@ -879,7 +885,13 @@ const GREEK_VARIANTS = {
|
|
|
879
885
|
120596
|
|
880
886
|
],
|
|
881
887
|
nabla: 120571,
|
|
882
|
-
partial: 120597
|
|
888
|
+
partial: 120597,
|
|
889
|
+
epsilon: 120598,
|
|
890
|
+
theta: 120599,
|
|
891
|
+
kappa: 120600,
|
|
892
|
+
phi: 120601,
|
|
893
|
+
rho: 120602,
|
|
894
|
+
pi: 120603
|
|
883
895
|
},
|
|
884
896
|
"bold-italic": {
|
|
885
897
|
upper: [
|
|
@@ -935,7 +947,13 @@ const GREEK_VARIANTS = {
|
|
|
935
947
|
120654
|
|
936
948
|
],
|
|
937
949
|
nabla: 120629,
|
|
938
|
-
partial: 120655
|
|
950
|
+
partial: 120655,
|
|
951
|
+
epsilon: 120656,
|
|
952
|
+
theta: 120657,
|
|
953
|
+
kappa: 120658,
|
|
954
|
+
phi: 120659,
|
|
955
|
+
rho: 120660,
|
|
956
|
+
pi: 120661
|
|
939
957
|
},
|
|
940
958
|
"bold-sans-serif": {
|
|
941
959
|
upper: [
|
|
@@ -991,7 +1009,13 @@ const GREEK_VARIANTS = {
|
|
|
991
1009
|
120712
|
|
992
1010
|
],
|
|
993
1011
|
nabla: 120687,
|
|
994
|
-
partial: 120713
|
|
1012
|
+
partial: 120713,
|
|
1013
|
+
epsilon: 120714,
|
|
1014
|
+
theta: 120715,
|
|
1015
|
+
kappa: 120716,
|
|
1016
|
+
phi: 120717,
|
|
1017
|
+
rho: 120718,
|
|
1018
|
+
pi: 120719
|
|
995
1019
|
},
|
|
996
1020
|
"sans-serif-bold-italic": {
|
|
997
1021
|
upper: [
|
|
@@ -1047,9 +1071,23 @@ const GREEK_VARIANTS = {
|
|
|
1047
1071
|
120770
|
|
1048
1072
|
],
|
|
1049
1073
|
nabla: 120745,
|
|
1050
|
-
partial: 120771
|
|
1074
|
+
partial: 120771,
|
|
1075
|
+
epsilon: 120772,
|
|
1076
|
+
theta: 120773,
|
|
1077
|
+
kappa: 120774,
|
|
1078
|
+
phi: 120775,
|
|
1079
|
+
rho: 120776,
|
|
1080
|
+
pi: 120777
|
|
1051
1081
|
}
|
|
1052
1082
|
};
|
|
1083
|
+
const GREEK_SYMBOL_BASES = /* @__PURE__ */ new Map([
|
|
1084
|
+
[1013, "epsilon"],
|
|
1085
|
+
[977, "theta"],
|
|
1086
|
+
[1008, "kappa"],
|
|
1087
|
+
[981, "phi"],
|
|
1088
|
+
[1009, "rho"],
|
|
1089
|
+
[982, "pi"]
|
|
1090
|
+
]);
|
|
1053
1091
|
const DIGIT_VARIANTS = {
|
|
1054
1092
|
bold: [
|
|
1055
1093
|
120782,
|
|
@@ -1123,6 +1161,11 @@ function mapMathVariant(codePoint, variant) {
|
|
|
1123
1161
|
if (greekLowerIndex !== -1) return GREEK_VARIANTS[variant]?.lower[greekLowerIndex] ?? codePoint;
|
|
1124
1162
|
if (codePoint === 8711) return GREEK_VARIANTS[variant]?.nabla ?? codePoint;
|
|
1125
1163
|
if (codePoint === 8706) return GREEK_VARIANTS[variant]?.partial ?? codePoint;
|
|
1164
|
+
const symbolField = GREEK_SYMBOL_BASES.get(codePoint);
|
|
1165
|
+
if (symbolField !== void 0) {
|
|
1166
|
+
const entry = GREEK_VARIANTS[variant];
|
|
1167
|
+
return entry === void 0 ? codePoint : entry[symbolField];
|
|
1168
|
+
}
|
|
1126
1169
|
return codePoint;
|
|
1127
1170
|
}
|
|
1128
1171
|
function applyMathVariant(text, variant) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let document_schema_js = require("document-schema.js");
|
|
3
|
+
//#region src/model/embedded-drawing.ts
|
|
4
|
+
function buildDrawingBlock(size, vectors) {
|
|
5
|
+
const page = {
|
|
6
|
+
size,
|
|
7
|
+
shapes: [],
|
|
8
|
+
vectors: [...vectors]
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
kind: "embeddedObject",
|
|
12
|
+
objectKind: "drawing",
|
|
13
|
+
document: {
|
|
14
|
+
kind: "drawing",
|
|
15
|
+
formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
|
|
16
|
+
metadata: {},
|
|
17
|
+
pages: [page]
|
|
18
|
+
},
|
|
19
|
+
frame: {
|
|
20
|
+
xPt: 0,
|
|
21
|
+
yPt: 0,
|
|
22
|
+
widthPt: size.widthPt,
|
|
23
|
+
heightPt: size.heightPt
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function drawingOfBlock(block) {
|
|
28
|
+
return block.document.kind === "drawing" ? block.document : void 0;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.buildDrawingBlock = buildDrawingBlock;
|
|
32
|
+
exports.drawingOfBlock = drawingOfBlock;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ContentDocument, ContentEmbeddedObjectBlock, ContentVector, PageSize } from "document-schema.js";
|
|
2
|
+
//#region src/model/embedded-drawing.d.ts
|
|
3
|
+
declare function buildDrawingBlock(size: PageSize, vectors: readonly ContentVector[]): ContentEmbeddedObjectBlock;
|
|
4
|
+
declare function drawingOfBlock(block: ContentEmbeddedObjectBlock): Extract<ContentDocument, {
|
|
5
|
+
kind: 'drawing';
|
|
6
|
+
}> | undefined;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { buildDrawingBlock, drawingOfBlock };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ContentDocument, ContentEmbeddedObjectBlock, ContentVector, PageSize } from "document-schema.js";
|
|
2
|
+
//#region src/model/embedded-drawing.d.ts
|
|
3
|
+
declare function buildDrawingBlock(size: PageSize, vectors: readonly ContentVector[]): ContentEmbeddedObjectBlock;
|
|
4
|
+
declare function drawingOfBlock(block: ContentEmbeddedObjectBlock): Extract<ContentDocument, {
|
|
5
|
+
kind: 'drawing';
|
|
6
|
+
}> | undefined;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { buildDrawingBlock, drawingOfBlock };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CONTENT_FORMAT_VERSION } from "document-schema.js";
|
|
2
|
+
//#region src/model/embedded-drawing.ts
|
|
3
|
+
function buildDrawingBlock(size, vectors) {
|
|
4
|
+
const page = {
|
|
5
|
+
size,
|
|
6
|
+
shapes: [],
|
|
7
|
+
vectors: [...vectors]
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
kind: "embeddedObject",
|
|
11
|
+
objectKind: "drawing",
|
|
12
|
+
document: {
|
|
13
|
+
kind: "drawing",
|
|
14
|
+
formatVersion: CONTENT_FORMAT_VERSION,
|
|
15
|
+
metadata: {},
|
|
16
|
+
pages: [page]
|
|
17
|
+
},
|
|
18
|
+
frame: {
|
|
19
|
+
xPt: 0,
|
|
20
|
+
yPt: 0,
|
|
21
|
+
widthPt: size.widthPt,
|
|
22
|
+
heightPt: size.heightPt
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function drawingOfBlock(block) {
|
|
27
|
+
return block.document.kind === "drawing" ? block.document : void 0;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { buildDrawingBlock, drawingOfBlock };
|
package/dist/model/formula.cjs
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let document_schema_js = require("document-schema.js");
|
|
3
|
+
//#region src/model/formula.ts
|
|
4
|
+
function formulaDocument(formula, metadata = {}) {
|
|
5
|
+
return {
|
|
6
|
+
kind: "formula",
|
|
7
|
+
formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
|
|
8
|
+
metadata,
|
|
9
|
+
formula
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function buildFormulaBlock(formula, frame, sourcePath) {
|
|
13
|
+
return {
|
|
14
|
+
kind: "embeddedObject",
|
|
15
|
+
objectKind: "formula",
|
|
16
|
+
document: formulaDocument(formula),
|
|
17
|
+
frame,
|
|
18
|
+
sourcePath
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function formulaOfBlock(block) {
|
|
22
|
+
return block.document.kind === "formula" ? block.document.formula : void 0;
|
|
23
|
+
}
|
|
24
|
+
function formulaPlaceholderText(formula) {
|
|
25
|
+
return formula.starMath ?? "[formula]";
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.buildFormulaBlock = buildFormulaBlock;
|
|
29
|
+
exports.formulaDocument = formulaDocument;
|
|
30
|
+
exports.formulaOfBlock = formulaOfBlock;
|
|
31
|
+
exports.formulaPlaceholderText = formulaPlaceholderText;
|
package/dist/model/formula.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Box, ContentDocument, ContentEmbeddedObjectBlock, ContentFormula, LayoutMetadata } from "document-schema.js";
|
|
2
2
|
//#region src/model/formula.d.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
declare function formulaDocument(formula: ContentFormula, metadata?: LayoutMetadata): ContentDocument;
|
|
4
|
+
declare function buildFormulaBlock(formula: ContentFormula, frame: Box, sourcePath: string): ContentEmbeddedObjectBlock;
|
|
5
|
+
declare function formulaOfBlock(block: ContentEmbeddedObjectBlock): ContentFormula | undefined;
|
|
6
|
+
declare function formulaPlaceholderText(formula: ContentFormula): string;
|
|
7
7
|
//#endregion
|
|
8
|
-
export {
|
|
8
|
+
export { buildFormulaBlock, formulaDocument, formulaOfBlock, formulaPlaceholderText };
|
package/dist/model/formula.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Box, ContentDocument, ContentEmbeddedObjectBlock, ContentFormula, LayoutMetadata } from "document-schema.js";
|
|
2
2
|
//#region src/model/formula.d.ts
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
declare function formulaDocument(formula: ContentFormula, metadata?: LayoutMetadata): ContentDocument;
|
|
4
|
+
declare function buildFormulaBlock(formula: ContentFormula, frame: Box, sourcePath: string): ContentEmbeddedObjectBlock;
|
|
5
|
+
declare function formulaOfBlock(block: ContentEmbeddedObjectBlock): ContentFormula | undefined;
|
|
6
|
+
declare function formulaPlaceholderText(formula: ContentFormula): string;
|
|
7
7
|
//#endregion
|
|
8
|
-
export {
|
|
8
|
+
export { buildFormulaBlock, formulaDocument, formulaOfBlock, formulaPlaceholderText };
|
package/dist/model/formula.js
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CONTENT_FORMAT_VERSION } from "document-schema.js";
|
|
2
|
+
//#region src/model/formula.ts
|
|
3
|
+
function formulaDocument(formula, metadata = {}) {
|
|
4
|
+
return {
|
|
5
|
+
kind: "formula",
|
|
6
|
+
formatVersion: CONTENT_FORMAT_VERSION,
|
|
7
|
+
metadata,
|
|
8
|
+
formula
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function buildFormulaBlock(formula, frame, sourcePath) {
|
|
12
|
+
return {
|
|
13
|
+
kind: "embeddedObject",
|
|
14
|
+
objectKind: "formula",
|
|
15
|
+
document: formulaDocument(formula),
|
|
16
|
+
frame,
|
|
17
|
+
sourcePath
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function formulaOfBlock(block) {
|
|
21
|
+
return block.document.kind === "formula" ? block.document.formula : void 0;
|
|
22
|
+
}
|
|
23
|
+
function formulaPlaceholderText(formula) {
|
|
24
|
+
return formula.starMath ?? "[formula]";
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { buildFormulaBlock, formulaDocument, formulaOfBlock, formulaPlaceholderText };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PAGE_SIZE_A4, c as PageSizeSchema, d as flipY, i as MarginsSchema, l as SLIDE_SIZE_STANDARD, n as BoxSchema, o as PAGE_SIZE_LETTER, r as Margins, s as PageSize, t as Box, u as SLIDE_SIZE_WIDESCREEN } from "../geometry-
|
|
1
|
+
import { a as PAGE_SIZE_A4, c as PageSizeSchema, d as flipY, i as MarginsSchema, l as SLIDE_SIZE_STANDARD, n as BoxSchema, o as PAGE_SIZE_LETTER, r as Margins, s as PageSize, t as Box, u as SLIDE_SIZE_WIDESCREEN } from "../geometry-DaJr8yQW.cjs";
|
|
2
2
|
export { type Box, BoxSchema, type Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type PageSize, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, flipY };
|
package/dist/model/geometry.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PAGE_SIZE_A4, c as PageSizeSchema, d as flipY, i as MarginsSchema, l as SLIDE_SIZE_STANDARD, n as BoxSchema, o as PAGE_SIZE_LETTER, r as Margins, s as PageSize, t as Box, u as SLIDE_SIZE_WIDESCREEN } from "../geometry-
|
|
1
|
+
import { a as PAGE_SIZE_A4, c as PageSizeSchema, d as flipY, i as MarginsSchema, l as SLIDE_SIZE_STANDARD, n as BoxSchema, o as PAGE_SIZE_LETTER, r as Margins, s as PageSize, t as Box, u as SLIDE_SIZE_WIDESCREEN } from "../geometry-DaJr8yQW.js";
|
|
2
2
|
export { type Box, BoxSchema, type Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type PageSize, PageSizeSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, flipY };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/model/paint-order.ts
|
|
3
|
+
function mergeByPaintOrder(vectors, shapes) {
|
|
4
|
+
const entries = [...vectors.map((value) => ({
|
|
5
|
+
kind: "vector",
|
|
6
|
+
value
|
|
7
|
+
})), ...shapes.map((value) => ({
|
|
8
|
+
kind: "shape",
|
|
9
|
+
value
|
|
10
|
+
}))];
|
|
11
|
+
if (entries.some((entry) => entry.value.paintOrder === void 0)) return entries;
|
|
12
|
+
return entries.sort((a, b) => (a.value.paintOrder ?? 0) - (b.value.paintOrder ?? 0));
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.mergeByPaintOrder = mergeByPaintOrder;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/model/paint-order.d.ts
|
|
2
|
+
interface PaintOrdered {
|
|
3
|
+
readonly paintOrder?: number;
|
|
4
|
+
}
|
|
5
|
+
type PaintOrderEntry<V, S> = {
|
|
6
|
+
readonly kind: 'vector';
|
|
7
|
+
readonly value: V;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'shape';
|
|
10
|
+
readonly value: S;
|
|
11
|
+
};
|
|
12
|
+
declare function mergeByPaintOrder<V extends PaintOrdered, S extends PaintOrdered>(vectors: readonly V[], shapes: readonly S[]): PaintOrderEntry<V, S>[];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { PaintOrderEntry, PaintOrdered, mergeByPaintOrder };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/model/paint-order.d.ts
|
|
2
|
+
interface PaintOrdered {
|
|
3
|
+
readonly paintOrder?: number;
|
|
4
|
+
}
|
|
5
|
+
type PaintOrderEntry<V, S> = {
|
|
6
|
+
readonly kind: 'vector';
|
|
7
|
+
readonly value: V;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: 'shape';
|
|
10
|
+
readonly value: S;
|
|
11
|
+
};
|
|
12
|
+
declare function mergeByPaintOrder<V extends PaintOrdered, S extends PaintOrdered>(vectors: readonly V[], shapes: readonly S[]): PaintOrderEntry<V, S>[];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { PaintOrderEntry, PaintOrdered, mergeByPaintOrder };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/model/paint-order.ts
|
|
2
|
+
function mergeByPaintOrder(vectors, shapes) {
|
|
3
|
+
const entries = [...vectors.map((value) => ({
|
|
4
|
+
kind: "vector",
|
|
5
|
+
value
|
|
6
|
+
})), ...shapes.map((value) => ({
|
|
7
|
+
kind: "shape",
|
|
8
|
+
value
|
|
9
|
+
}))];
|
|
10
|
+
if (entries.some((entry) => entry.value.paintOrder === void 0)) return entries;
|
|
11
|
+
return entries.sort((a, b) => (a.value.paintOrder ?? 0) - (b.value.paintOrder ?? 0));
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { mergeByPaintOrder };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let odf_js = require("odf.js");
|
|
3
|
+
//#region src/odb/components.ts
|
|
4
|
+
function readOdbForms(pkg) {
|
|
5
|
+
return (0, odf_js.readOdbInventory)(pkg).forms.map((component) => (0, odf_js.readOdbForm)(pkg, component.name));
|
|
6
|
+
}
|
|
7
|
+
function readOdbReports(pkg) {
|
|
8
|
+
return (0, odf_js.readOdbInventory)(pkg).reports.map((component) => (0, odf_js.readOdbReport)(pkg, component.name));
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.readOdbForms = readOdbForms;
|
|
12
|
+
exports.readOdbReports = readOdbReports;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OdbForm, OdbReport, Package } from "odf.js";
|
|
2
|
+
//#region src/odb/components.d.ts
|
|
3
|
+
declare function readOdbForms(pkg: Package): readonly OdbForm[];
|
|
4
|
+
declare function readOdbReports(pkg: Package): readonly OdbReport[];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { readOdbForms, readOdbReports };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OdbForm, OdbReport, Package } from "odf.js";
|
|
2
|
+
//#region src/odb/components.d.ts
|
|
3
|
+
declare function readOdbForms(pkg: Package): readonly OdbForm[];
|
|
4
|
+
declare function readOdbReports(pkg: Package): readonly OdbReport[];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { readOdbForms, readOdbReports };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { readOdbForm, readOdbInventory, readOdbReport } from "odf.js";
|
|
2
|
+
//#region src/odb/components.ts
|
|
3
|
+
function readOdbForms(pkg) {
|
|
4
|
+
return readOdbInventory(pkg).forms.map((component) => readOdbForm(pkg, component.name));
|
|
5
|
+
}
|
|
6
|
+
function readOdbReports(pkg) {
|
|
7
|
+
return readOdbInventory(pkg).reports.map((component) => readOdbReport(pkg, component.name));
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { readOdbForms, readOdbReports };
|
package/dist/odb/read.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_hsqldb_script = require("../hsqldb/script.cjs");
|
|
3
|
+
const require_hsqldb_binary_script = require("../hsqldb/binary-script.cjs");
|
|
3
4
|
const require_hsqldb_cache = require("../hsqldb/cache.cjs");
|
|
4
5
|
const require_firebird_backup = require("../firebird/backup.cjs");
|
|
5
6
|
let odf_js = require("odf.js");
|
|
@@ -44,7 +45,7 @@ function classifyScriptBytes(bytes) {
|
|
|
44
45
|
}
|
|
45
46
|
return "text";
|
|
46
47
|
}
|
|
47
|
-
function readOdbTables(pkg) {
|
|
48
|
+
function readOdbTables(pkg, options) {
|
|
48
49
|
const inventory = (0, odf_js.readOdbInventory)(pkg);
|
|
49
50
|
if (inventory.connection === void 0 || inventory.connection.type === "external") throw new OdbNoEmbeddedDataSourceError(inventory.connection?.url);
|
|
50
51
|
const url = inventory.connection.url;
|
|
@@ -65,21 +66,24 @@ function readOdbTables(pkg) {
|
|
|
65
66
|
if (scriptPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_SCRIPT_PART} is not a binary part (found kind "${scriptPart.kind}") -- malformed .odb package`);
|
|
66
67
|
const scriptBytes = (0, odf_js.base64ToBytes)(scriptPart.base64);
|
|
67
68
|
const classification = classifyScriptBytes(scriptBytes);
|
|
68
|
-
if (classification
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
if (classification !== "text") {
|
|
70
|
+
const binaryBytes = classification === "compressed" ? require_hsqldb_binary_script.inflateHsqldbCompressedScript(scriptBytes) : scriptBytes;
|
|
71
|
+
const { scriptText, tables } = require_hsqldb_binary_script.parseHsqldbBinaryScript(binaryBytes, options);
|
|
72
|
+
return withCachedTableRows(pkg, tables, scriptText, options);
|
|
73
|
+
}
|
|
74
|
+
const scriptText = new TextDecoder("utf-8", { fatal: true }).decode(scriptBytes);
|
|
75
|
+
return withCachedTableRows(pkg, require_hsqldb_script.parseHsqldbScript(scriptBytes), scriptText, options);
|
|
71
76
|
}
|
|
72
|
-
function withCachedTableRows(pkg, tables,
|
|
77
|
+
function withCachedTableRows(pkg, tables, scriptText, options) {
|
|
73
78
|
const dataPart = pkg.parts[DATABASE_DATA_PART];
|
|
74
79
|
if (dataPart === void 0) return tables;
|
|
75
80
|
if (dataPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is not a binary part (found kind "${dataPart.kind}") -- malformed .odb package`);
|
|
76
81
|
const propertiesPart = pkg.parts[DATABASE_PROPERTIES_PART];
|
|
77
82
|
if (propertiesPart === void 0) throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is present but ${DATABASE_PROPERTIES_PART} is not -- malformed .odb package (a CACHED-table row store always ships alongside its own properties file, which this decoder needs for the cache file's own scale)`);
|
|
78
83
|
if (propertiesPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_PROPERTIES_PART} is not a binary part (found kind "${propertiesPart.kind}") -- malformed .odb package`);
|
|
79
|
-
const scriptText = new TextDecoder("utf-8", { fatal: true }).decode(scriptBytes);
|
|
80
84
|
const dataBytes = (0, odf_js.base64ToBytes)(dataPart.base64);
|
|
81
85
|
const propertiesText = new TextDecoder("utf-8", { fatal: true }).decode((0, odf_js.base64ToBytes)(propertiesPart.base64));
|
|
82
|
-
return require_hsqldb_cache.decodeHsqldbCachedTables(tables, scriptText, dataBytes, propertiesText);
|
|
86
|
+
return require_hsqldb_cache.decodeHsqldbCachedTables(tables, scriptText, dataBytes, propertiesText, options);
|
|
83
87
|
}
|
|
84
88
|
//#endregion
|
|
85
89
|
exports.OdbNoEmbeddedDataSourceError = OdbNoEmbeddedDataSourceError;
|
package/dist/odb/read.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.cjs";
|
|
1
2
|
import { HsqldbTable } from "../hsqldb/script.cjs";
|
|
2
3
|
import { Package } from "odf.js";
|
|
3
4
|
//#region src/odb/read.d.ts
|
|
@@ -5,11 +6,11 @@ declare class OdbNoEmbeddedDataSourceError extends Error {
|
|
|
5
6
|
readonly url: string | undefined;
|
|
6
7
|
constructor(url: string | undefined);
|
|
7
8
|
}
|
|
8
|
-
type OdbUnsupportedFormat = '
|
|
9
|
+
type OdbUnsupportedFormat = 'unrecognised-engine';
|
|
9
10
|
declare class OdbUnsupportedFormatError extends Error {
|
|
10
11
|
readonly format: OdbUnsupportedFormat;
|
|
11
12
|
constructor(format: OdbUnsupportedFormat, detail: string);
|
|
12
13
|
}
|
|
13
|
-
declare function readOdbTables(pkg: Package): readonly HsqldbTable[];
|
|
14
|
+
declare function readOdbTables(pkg: Package, options?: HsqldbDecodeOptions): readonly HsqldbTable[];
|
|
14
15
|
//#endregion
|
|
15
16
|
export { OdbNoEmbeddedDataSourceError, OdbUnsupportedFormat, OdbUnsupportedFormatError, readOdbTables };
|
package/dist/odb/read.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.js";
|
|
1
2
|
import { HsqldbTable } from "../hsqldb/script.js";
|
|
2
3
|
import { Package } from "odf.js";
|
|
3
4
|
//#region src/odb/read.d.ts
|
|
@@ -5,11 +6,11 @@ declare class OdbNoEmbeddedDataSourceError extends Error {
|
|
|
5
6
|
readonly url: string | undefined;
|
|
6
7
|
constructor(url: string | undefined);
|
|
7
8
|
}
|
|
8
|
-
type OdbUnsupportedFormat = '
|
|
9
|
+
type OdbUnsupportedFormat = 'unrecognised-engine';
|
|
9
10
|
declare class OdbUnsupportedFormatError extends Error {
|
|
10
11
|
readonly format: OdbUnsupportedFormat;
|
|
11
12
|
constructor(format: OdbUnsupportedFormat, detail: string);
|
|
12
13
|
}
|
|
13
|
-
declare function readOdbTables(pkg: Package): readonly HsqldbTable[];
|
|
14
|
+
declare function readOdbTables(pkg: Package, options?: HsqldbDecodeOptions): readonly HsqldbTable[];
|
|
14
15
|
//#endregion
|
|
15
16
|
export { OdbNoEmbeddedDataSourceError, OdbUnsupportedFormat, OdbUnsupportedFormatError, readOdbTables };
|
package/dist/odb/read.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readManifest } from "../odf-package/manifest.js";
|
|
2
2
|
import { parseHsqldbScript } from "../hsqldb/script.js";
|
|
3
|
+
import { inflateHsqldbCompressedScript, parseHsqldbBinaryScript } from "../hsqldb/binary-script.js";
|
|
3
4
|
import { decodeHsqldbCachedTables } from "../hsqldb/cache.js";
|
|
4
5
|
import { readFirebirdBackup } from "../firebird/backup.js";
|
|
5
6
|
import { base64ToBytes, readOdbInventory } from "odf.js";
|
|
@@ -44,7 +45,7 @@ function classifyScriptBytes(bytes) {
|
|
|
44
45
|
}
|
|
45
46
|
return "text";
|
|
46
47
|
}
|
|
47
|
-
function readOdbTables(pkg) {
|
|
48
|
+
function readOdbTables(pkg, options) {
|
|
48
49
|
const inventory = readOdbInventory(pkg);
|
|
49
50
|
if (inventory.connection === void 0 || inventory.connection.type === "external") throw new OdbNoEmbeddedDataSourceError(inventory.connection?.url);
|
|
50
51
|
const url = inventory.connection.url;
|
|
@@ -65,21 +66,24 @@ function readOdbTables(pkg) {
|
|
|
65
66
|
if (scriptPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_SCRIPT_PART} is not a binary part (found kind "${scriptPart.kind}") -- malformed .odb package`);
|
|
66
67
|
const scriptBytes = base64ToBytes(scriptPart.base64);
|
|
67
68
|
const classification = classifyScriptBytes(scriptBytes);
|
|
68
|
-
if (classification
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
if (classification !== "text") {
|
|
70
|
+
const binaryBytes = classification === "compressed" ? inflateHsqldbCompressedScript(scriptBytes) : scriptBytes;
|
|
71
|
+
const { scriptText, tables } = parseHsqldbBinaryScript(binaryBytes, options);
|
|
72
|
+
return withCachedTableRows(pkg, tables, scriptText, options);
|
|
73
|
+
}
|
|
74
|
+
const scriptText = new TextDecoder("utf-8", { fatal: true }).decode(scriptBytes);
|
|
75
|
+
return withCachedTableRows(pkg, parseHsqldbScript(scriptBytes), scriptText, options);
|
|
71
76
|
}
|
|
72
|
-
function withCachedTableRows(pkg, tables,
|
|
77
|
+
function withCachedTableRows(pkg, tables, scriptText, options) {
|
|
73
78
|
const dataPart = pkg.parts[DATABASE_DATA_PART];
|
|
74
79
|
if (dataPart === void 0) return tables;
|
|
75
80
|
if (dataPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is not a binary part (found kind "${dataPart.kind}") -- malformed .odb package`);
|
|
76
81
|
const propertiesPart = pkg.parts[DATABASE_PROPERTIES_PART];
|
|
77
82
|
if (propertiesPart === void 0) throw new Error(`readOdbTables: ${DATABASE_DATA_PART} is present but ${DATABASE_PROPERTIES_PART} is not -- malformed .odb package (a CACHED-table row store always ships alongside its own properties file, which this decoder needs for the cache file's own scale)`);
|
|
78
83
|
if (propertiesPart.kind !== "binary") throw new Error(`readOdbTables: ${DATABASE_PROPERTIES_PART} is not a binary part (found kind "${propertiesPart.kind}") -- malformed .odb package`);
|
|
79
|
-
const scriptText = new TextDecoder("utf-8", { fatal: true }).decode(scriptBytes);
|
|
80
84
|
const dataBytes = base64ToBytes(dataPart.base64);
|
|
81
85
|
const propertiesText = new TextDecoder("utf-8", { fatal: true }).decode(base64ToBytes(propertiesPart.base64));
|
|
82
|
-
return decodeHsqldbCachedTables(tables, scriptText, dataBytes, propertiesText);
|
|
86
|
+
return decodeHsqldbCachedTables(tables, scriptText, dataBytes, propertiesText, options);
|
|
83
87
|
}
|
|
84
88
|
//#endregion
|
|
85
89
|
export { OdbNoEmbeddedDataSourceError, OdbUnsupportedFormatError, readOdbTables };
|
|
@@ -5,25 +5,93 @@ let odf_js = require("odf.js");
|
|
|
5
5
|
function subPackagePathFromHref(href) {
|
|
6
6
|
return href.replace(/^#?\.\//, "");
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
function formulaOfFrame(frame, pkg) {
|
|
9
|
+
const objectElement = (0, odf_js.childrenWithTag)(frame, "draw:object")[0];
|
|
10
|
+
if (objectElement === void 0) return;
|
|
11
|
+
const href = (0, odf_js.attrValue)(objectElement, "xlink:href");
|
|
12
|
+
if (href === void 0) return;
|
|
13
|
+
return require_odf_formula_read.readOdfEmbeddedFormula(pkg, subPackagePathFromHref(href));
|
|
14
|
+
}
|
|
15
|
+
function flowAnchoredFrameBox(frame) {
|
|
16
|
+
const widthValue = (0, odf_js.attrValue)(frame, "svg:width");
|
|
17
|
+
const heightValue = (0, odf_js.attrValue)(frame, "svg:height");
|
|
18
|
+
if (widthValue === void 0 || heightValue === void 0) return;
|
|
19
|
+
const widthPt = (0, odf_js.parseOdfLength)(widthValue);
|
|
20
|
+
const heightPt = (0, odf_js.parseOdfLength)(heightValue);
|
|
21
|
+
if (widthPt === void 0 || heightPt === void 0) return;
|
|
22
|
+
return {
|
|
23
|
+
xPt: 0,
|
|
24
|
+
yPt: 0,
|
|
25
|
+
widthPt,
|
|
26
|
+
heightPt
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function nestedGroupFunctions(group, groupFunctions) {
|
|
30
|
+
const value = (0, odf_js.attrValue)(group, "draw:transform");
|
|
31
|
+
const own = value === void 0 ? [] : (0, odf_js.parseOdfTransform)(value);
|
|
32
|
+
return own.length === 0 ? groupFunctions : [...own, ...groupFunctions];
|
|
33
|
+
}
|
|
34
|
+
function readFormulaFrame(frame, groupFunctions, pkg, allowFlowAnchored) {
|
|
35
|
+
const formula = formulaOfFrame(frame, pkg);
|
|
36
|
+
if (formula === void 0) return;
|
|
37
|
+
const box = (0, odf_js.readDrawFrame)(frame, groupFunctions, pkg)?.frame ?? (allowFlowAnchored ? flowAnchoredFrameBox(frame) : void 0);
|
|
38
|
+
if (box === void 0) return;
|
|
39
|
+
return {
|
|
40
|
+
frameElement: frame,
|
|
41
|
+
formula,
|
|
42
|
+
frame: box
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function walkForFormulaFrames(nodes, groupFunctions, pkg, out) {
|
|
46
|
+
for (const node of nodes) {
|
|
47
|
+
if (node.type !== "element") continue;
|
|
48
|
+
if (node.tag === "draw:frame") {
|
|
49
|
+
const detected = readFormulaFrame(node, groupFunctions, pkg, true);
|
|
50
|
+
if (detected !== void 0) {
|
|
51
|
+
out.push(detected);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
walkForFormulaFrames(node.children, groupFunctions, pkg, out);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (node.tag === "draw:g") {
|
|
58
|
+
walkForFormulaFrames(node.children, nestedGroupFunctions(node, groupFunctions), pkg, out);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
walkForFormulaFrames(node.children, groupFunctions, pkg, out);
|
|
25
62
|
}
|
|
63
|
+
}
|
|
64
|
+
function collectFormulaFrames(nodes, pkg) {
|
|
65
|
+
const out = [];
|
|
66
|
+
walkForFormulaFrames(nodes, [], pkg, out);
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
function collectSlideFormulaFrames(pageChildren, pkg) {
|
|
70
|
+
const out = [];
|
|
71
|
+
const state = { nextShapeIndex: 0 };
|
|
72
|
+
const walk = (nodes, groupFunctions) => {
|
|
73
|
+
for (const node of nodes) {
|
|
74
|
+
if (node.type !== "element") continue;
|
|
75
|
+
if (node.tag === "draw:frame") {
|
|
76
|
+
const shape = (0, odf_js.readDrawFrame)(node, groupFunctions, pkg);
|
|
77
|
+
if (shape === void 0) continue;
|
|
78
|
+
const shapeIndex = state.nextShapeIndex;
|
|
79
|
+
state.nextShapeIndex += 1;
|
|
80
|
+
const formula = formulaOfFrame(node, pkg);
|
|
81
|
+
if (formula !== void 0) out.push({
|
|
82
|
+
frameElement: node,
|
|
83
|
+
formula,
|
|
84
|
+
frame: shape.frame,
|
|
85
|
+
shapeIndex
|
|
86
|
+
});
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (node.tag === "draw:g") walk(node.children, nestedGroupFunctions(node, groupFunctions));
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
walk(pageChildren, []);
|
|
26
93
|
return out;
|
|
27
94
|
}
|
|
28
95
|
//#endregion
|
|
29
|
-
exports.
|
|
96
|
+
exports.collectFormulaFrames = collectFormulaFrames;
|
|
97
|
+
exports.collectSlideFormulaFrames = collectSlideFormulaFrames;
|