js.documents 14.6.4 → 14.6.6
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 +3 -3
- package/dist/{composition-plan-DMTkmk8n.js → composition-plan-BLhc55_x.js} +1 -1
- package/dist/{composition-plan-DJQgPvBj.cjs → composition-plan-CgjS-XZU.cjs} +1 -1
- package/dist/convert/composition-plan.cjs +1 -1
- package/dist/convert/composition-plan.js +1 -1
- package/dist/convert/composition-to-pdf.cjs +1 -1
- package/dist/convert/composition-to-pdf.js +1 -1
- package/dist/convert/composition.cjs +1 -1
- package/dist/convert/composition.js +1 -1
- package/dist/convert/from-pdf.cjs +2 -2
- package/dist/convert/from-pdf.js +2 -2
- package/dist/convert/local.cjs +1 -1
- package/dist/convert/local.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/layout/lattice.cjs +28 -5
- package/dist/layout/lattice.d.cts +16 -1
- package/dist/layout/lattice.d.ts +16 -1
- package/dist/layout/lattice.js +25 -6
- package/dist/layout/reading-order.cjs +2 -0
- package/dist/layout/reading-order.d.cts +3 -1
- package/dist/layout/reading-order.d.ts +3 -1
- package/dist/layout/reading-order.js +1 -1
- package/dist/layout/reconstruct-lines.cjs +41 -11
- package/dist/layout/reconstruct-lines.js +42 -12
- package/dist/layout/reconstruct-presentations-prod.cjs +1 -1
- package/dist/layout/reconstruct-presentations-prod.js +1 -1
- package/dist/layout/reconstruct-tables.cjs +1 -1
- package/dist/layout/reconstruct-tables.js +1 -1
- package/dist/layout/reconstruct.cjs +1 -1
- package/dist/layout/reconstruct.js +1 -1
- package/dist/layout/ruled-rows.cjs +214 -0
- package/dist/layout/ruled-rows.d.cts +11 -0
- package/dist/layout/ruled-rows.d.ts +11 -0
- package/dist/layout/ruled-rows.js +213 -0
- package/dist/{reconstruct-presentations-prod-D1KbGPxa.js → reconstruct-presentations-prod-DV7UQqMT.js} +19 -5
- package/dist/{reconstruct-presentations-prod-CsvGlvP2.cjs → reconstruct-presentations-prod-DtpKKgRY.cjs} +19 -5
- package/package.json +3 -3
|
@@ -6,6 +6,7 @@ const require_ports_abort = require("./ports/abort.cjs");
|
|
|
6
6
|
const require_layout_reconstruct_lines = require("./layout/reconstruct-lines.cjs");
|
|
7
7
|
const require_layout_lattice = require("./layout/lattice.cjs");
|
|
8
8
|
const require_layout_reading_order = require("./layout/reading-order.cjs");
|
|
9
|
+
const require_layout_ruled_rows = require("./layout/ruled-rows.cjs");
|
|
9
10
|
let document_schema_js = require("document-schema.js");
|
|
10
11
|
let pdf_codec_layout = require("pdf-codec/layout");
|
|
11
12
|
//#region src/layout/reconstruct-tables.ts
|
|
@@ -14,8 +15,23 @@ function recoverTables(page, pageIndex, structure) {
|
|
|
14
15
|
const tagged = recoverTaggedTables(page, pageIndex, structure);
|
|
15
16
|
if (tagged.length > 0) return tagged;
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
-
|
|
18
|
+
const grid = require_layout_lattice.detectGridLattice(page.items);
|
|
19
|
+
const gridItems = grid?.sourceItems ?? NO_ITEMS;
|
|
20
|
+
return [grid, require_layout_ruled_rows.detectRuledRowLattice(page.items.filter((item) => !gridItems.has(item)))].filter((lattice) => lattice !== void 0).filter((lattice, index, lattices) => index === 0 || !latticesOverlap(lattices[0], lattice)).flatMap((lattice) => {
|
|
21
|
+
const table = recoverTable(page, pageIndex, lattice);
|
|
22
|
+
return table === void 0 ? [] : [table];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function latticesOverlap(a, b) {
|
|
26
|
+
const aLeft = a.columnBoundariesAscPt[0];
|
|
27
|
+
const aRight = a.columnBoundariesAscPt.at(-1);
|
|
28
|
+
const aTop = a.rowBoundariesDescPt[0];
|
|
29
|
+
const aBottom = a.rowBoundariesDescPt.at(-1);
|
|
30
|
+
const bLeft = b.columnBoundariesAscPt[0];
|
|
31
|
+
const bRight = b.columnBoundariesAscPt.at(-1);
|
|
32
|
+
const bTop = b.rowBoundariesDescPt[0];
|
|
33
|
+
const bBottom = b.rowBoundariesDescPt.at(-1);
|
|
34
|
+
return aLeft < bRight && bLeft < aRight && aBottom < bTop && bBottom < aTop;
|
|
19
35
|
}
|
|
20
36
|
function recoverTaggedTables(page, pageIndex, structure) {
|
|
21
37
|
const cellsByTable = /* @__PURE__ */ new Map();
|
|
@@ -126,9 +142,7 @@ function indexRegions(lattice, rowCount, columnCount) {
|
|
|
126
142
|
for (const region of lattice.regions) for (let i = region.rowStart; i < region.rowEnd; i++) for (let j = region.colStart; j < region.colEnd; j++) regionAt[i][j] = region;
|
|
127
143
|
return regionAt;
|
|
128
144
|
}
|
|
129
|
-
function recoverTable(page, pageIndex) {
|
|
130
|
-
const lattice = require_layout_lattice.detectGridLattice(page.items);
|
|
131
|
-
if (lattice === void 0) return;
|
|
145
|
+
function recoverTable(page, pageIndex, lattice) {
|
|
132
146
|
const rowCount = lattice.rowBoundariesDescPt.length - 1;
|
|
133
147
|
const columnCount = lattice.columnBoundariesAscPt.length - 1;
|
|
134
148
|
const regionAt = indexRegions(lattice, rowCount, columnCount);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js.documents",
|
|
3
|
-
"version": "14.6.
|
|
3
|
+
"version": "14.6.6",
|
|
4
4
|
"description": "Converts between docx, pptx, odt, odp, ods, odg, xlsx, csv, svg, markdown, rtf, doc, xls, ppt and PDF through one shared, Zod-typed content schema (wpd read-only), plus read+write editors for OOXML and OpenDocument. Worker-isomorphic.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
"document-schema.js": "7.16.2",
|
|
84
84
|
"epub-codec": "5.1.17",
|
|
85
85
|
"fflate": "0.8.3",
|
|
86
|
-
"markdown-codec": "11.1
|
|
86
|
+
"markdown-codec": "11.2.1",
|
|
87
87
|
"odf.js": "11.2.3",
|
|
88
88
|
"ooxml.js": "12.2.33",
|
|
89
|
-
"pdf-codec": "5.
|
|
89
|
+
"pdf-codec": "5.7.0",
|
|
90
90
|
"ppt-codec": "2.2.24",
|
|
91
91
|
"rtf-codec": "8.1.25",
|
|
92
92
|
"temml": "0.13.4",
|