js.documents 8.0.0 → 9.0.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.
@@ -0,0 +1,45 @@
1
+ import { ContentTable, ContentTableCell } from "document-schema.js";
2
+ //#region src/edit/table-grid.d.ts
3
+ /**
4
+ * One position of a live table's grid, resolved to the live cell that owns it.
5
+ *
6
+ * A merged region owns every position it covers, so `cell` is the region's anchor cell wherever the position lies inside the region, and `isAnchor` tells the anchor's own top-left position (the one a view draws the region's content at) from the positions it covers.
7
+ */
8
+ interface TableGridCell<C> {
9
+ readonly cell: C;
10
+ readonly isAnchor: boolean;
11
+ }
12
+ /**
13
+ * The rows of a live table's grid: `rows[r][c]` is the position at grid row r and grid column c, and every row is as wide as the table's grid.
14
+ *
15
+ * An entry is `undefined` only where the source has no cell at all for a position and no merged region covers it, which is how a row shorter than its table's grid reads.
16
+ */
17
+ type TableGridRows<C> = readonly (readonly (TableGridCell<C> | undefined)[])[];
18
+ /** A live cell as the editing layer holds it: the grid column its own element starts at, and the spans that element states (an absent span is a span of one). */
19
+ interface PlacedLiveCell<C> {
20
+ readonly columnIndex: number;
21
+ readonly cell: C;
22
+ readonly colSpan: number | undefined;
23
+ readonly rowSpan: number | undefined;
24
+ }
25
+ /** A live table's grid: its width in columns and the resolved rows. */
26
+ interface LiveTableGrid<C> {
27
+ readonly columnCount: number;
28
+ readonly rows: TableGridRows<C>;
29
+ }
30
+ /**
31
+ * Resolve the cells a live table holds into its dense grid.
32
+ *
33
+ * A live table stores fewer cells than it has grid positions wherever its format omits the positions a merge covers (a docx `w:tc` per `w:gridSpan` region, an ODF row's real cells beside its covered ones), so the position of a cell is not its index in its row. This lays the cells out as the content pivot would, through the same `walkTableGrid` classification, so that coverage is derived from the anchors' spans and never re-derived here.
34
+ *
35
+ * `declaredColumnCount` is the grid width the source states on its own (a docx `w:tblGrid`); the result is that wide, or wider if a row places a cell past it.
36
+ */
37
+ declare function resolveLiveTableGrid<C>(rows: readonly (readonly PlacedLiveCell<C>[])[], declaredColumnCount: number): LiveTableGrid<C>;
38
+ /**
39
+ * Resolve a live table that is itself a ContentTable (an editor holding the content pivot directly rather than an XML tree) into its grid, wrapping each entry of a row in the live cell view `wrap` builds.
40
+ *
41
+ * A pivot table's rows are already dense, so an entry's index is its grid column and no width needs deriving; what this adds is the resolution of a covered position to the anchor that owns it, which is the same resolution the XML-backed editors need.
42
+ */
43
+ declare function resolvePivotTableGrid<C>(table: ContentTable, wrap: (cell: ContentTableCell) => C): LiveTableGrid<C>;
44
+ //#endregion
45
+ export { resolveLiveTableGrid as a, TableGridRows as i, PlacedLiveCell as n, resolvePivotTableGrid as o, TableGridCell as r, LiveTableGrid as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js.documents",
3
- "version": "8.0.0",
3
+ "version": "9.0.0",
4
4
  "description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -78,20 +78,20 @@
78
78
  "license": "MIT",
79
79
  "dependencies": {
80
80
  "archive-codec": "1.11.8",
81
- "byte-codec": "1.6.3",
82
- "doc-codec": "4.0.0",
81
+ "byte-codec": "1.7.0",
82
+ "doc-codec": "4.0.1",
83
83
  "document-schema.js": "7.12.0",
84
- "epub-codec": "3.0.0",
84
+ "epub-codec": "3.0.1",
85
85
  "fflate": "0.8.3",
86
- "markdown-codec": "8.0.0",
87
- "odf.js": "8.0.2",
88
- "ooxml.js": "10.0.0",
89
- "pdf-codec": "5.2.1",
90
- "ppt-codec": "2.0.2",
91
- "rtf-codec": "6.0.0",
86
+ "markdown-codec": "8.0.1",
87
+ "odf.js": "9.0.0",
88
+ "ooxml.js": "10.0.2",
89
+ "pdf-codec": "5.2.2",
90
+ "ppt-codec": "2.0.3",
91
+ "rtf-codec": "6.0.1",
92
92
  "temml": "0.13.4",
93
- "wpd-codec": "5.0.0",
94
- "xls-codec": "4.15.13",
93
+ "wpd-codec": "5.0.1",
94
+ "xls-codec": "4.15.14",
95
95
  "zod": "4.4.3"
96
96
  },
97
97
  "devDependencies": {