js.documents 8.0.1 → 10.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.
Files changed (39) hide show
  1. package/dist/edit/doc/table.cjs +10 -0
  2. package/dist/edit/doc/table.d.cts +4 -0
  3. package/dist/edit/doc/table.d.ts +4 -0
  4. package/dist/edit/doc/table.js +10 -0
  5. package/dist/edit/docx/content.cjs +2 -0
  6. package/dist/edit/docx/content.js +2 -0
  7. package/dist/edit/docx/table.cjs +110 -22
  8. package/dist/edit/docx/table.d.cts +5 -0
  9. package/dist/edit/docx/table.d.ts +5 -0
  10. package/dist/edit/docx/table.js +110 -22
  11. package/dist/edit/markdown/table.cjs +10 -0
  12. package/dist/edit/markdown/table.d.cts +4 -0
  13. package/dist/edit/markdown/table.d.ts +4 -0
  14. package/dist/edit/markdown/table.js +10 -0
  15. package/dist/edit/odp/slide.d.cts +1 -1
  16. package/dist/edit/odp/slide.d.ts +1 -1
  17. package/dist/edit/odt/content.cjs +2 -0
  18. package/dist/edit/odt/content.d.cts +1 -1
  19. package/dist/edit/odt/content.d.ts +1 -1
  20. package/dist/edit/odt/content.js +2 -0
  21. package/dist/edit/odt/editor.d.cts +1 -1
  22. package/dist/edit/odt/editor.d.ts +1 -1
  23. package/dist/edit/odt/table.cjs +45 -15
  24. package/dist/edit/odt/table.d.cts +1 -1
  25. package/dist/edit/odt/table.d.ts +1 -1
  26. package/dist/edit/odt/table.js +45 -15
  27. package/dist/edit/pptx/content.cjs +2 -0
  28. package/dist/edit/pptx/content.js +2 -0
  29. package/dist/edit/table-grid.cjs +66 -0
  30. package/dist/edit/table-grid.d.cts +2 -0
  31. package/dist/edit/table-grid.d.ts +2 -0
  32. package/dist/edit/table-grid.js +63 -0
  33. package/dist/index.d.cts +3 -2
  34. package/dist/index.d.ts +3 -2
  35. package/dist/{table-qWkzpadC.d.ts → table-BMYJo_-F.d.ts} +5 -1
  36. package/dist/{table-DvKlZmG0.d.cts → table-CCjF09Ho.d.cts} +5 -1
  37. package/dist/table-grid-Xbaddzz3.d.cts +49 -0
  38. package/dist/table-grid-Xbaddzz3.d.ts +49 -0
  39. package/package.json +13 -13
@@ -0,0 +1,49 @@
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
+ /**
45
+ * Throws when `table` breaks the grid rule (ContentTableCell in document-schema.js), naming `entryPoint` and the fault. The edit layer's builders write a covered position as a marker with no content of its own (a docx vertical-merge continuation, an ODF `table:covered-table-cell`, a pptx `hMerge`/`vMerge` cell), so a table whose covered positions carry blocks or spans, whose rows disagree about the grid, or whose regions run past the grid or into each other has no faithful spelling: the builder would drop what a covered position held, or guess which of two regions a position belongs to.
46
+ */
47
+ declare function assertTableObeysGridRule(table: ContentTable, entryPoint: string): void;
48
+ //#endregion
49
+ export { assertTableObeysGridRule as a, TableGridRows as i, PlacedLiveCell as n, resolveLiveTableGrid as o, TableGridCell as r, resolvePivotTableGrid as s, LiveTableGrid as t };
@@ -0,0 +1,49 @@
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
+ /**
45
+ * Throws when `table` breaks the grid rule (ContentTableCell in document-schema.js), naming `entryPoint` and the fault. The edit layer's builders write a covered position as a marker with no content of its own (a docx vertical-merge continuation, an ODF `table:covered-table-cell`, a pptx `hMerge`/`vMerge` cell), so a table whose covered positions carry blocks or spans, whose rows disagree about the grid, or whose regions run past the grid or into each other has no faithful spelling: the builder would drop what a covered position held, or guess which of two regions a position belongs to.
46
+ */
47
+ declare function assertTableObeysGridRule(table: ContentTable, entryPoint: string): void;
48
+ //#endregion
49
+ export { assertTableObeysGridRule as a, TableGridRows as i, PlacedLiveCell as n, resolveLiveTableGrid as o, TableGridCell as r, resolvePivotTableGrid as s, LiveTableGrid as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js.documents",
3
- "version": "8.0.1",
3
+ "version": "10.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": {
@@ -77,21 +77,21 @@
77
77
  ],
78
78
  "license": "MIT",
79
79
  "dependencies": {
80
- "archive-codec": "1.11.8",
80
+ "archive-codec": "1.11.9",
81
81
  "byte-codec": "1.7.0",
82
- "doc-codec": "4.0.1",
83
- "document-schema.js": "7.12.0",
84
- "epub-codec": "3.0.1",
82
+ "doc-codec": "5.0.0",
83
+ "document-schema.js": "7.13.0",
84
+ "epub-codec": "4.0.0",
85
85
  "fflate": "0.8.3",
86
- "markdown-codec": "8.0.1",
87
- "odf.js": "8.0.3",
88
- "ooxml.js": "10.0.1",
89
- "pdf-codec": "5.2.2",
90
- "ppt-codec": "2.0.3",
91
- "rtf-codec": "6.0.1",
86
+ "markdown-codec": "9.0.0",
87
+ "odf.js": "10.0.0",
88
+ "ooxml.js": "11.0.0",
89
+ "pdf-codec": "5.2.3",
90
+ "ppt-codec": "2.0.4",
91
+ "rtf-codec": "7.0.0",
92
92
  "temml": "0.13.4",
93
- "wpd-codec": "5.0.1",
94
- "xls-codec": "4.15.14",
93
+ "wpd-codec": "5.0.2",
94
+ "xls-codec": "4.15.15",
95
95
  "zod": "4.4.3"
96
96
  },
97
97
  "devDependencies": {