@threadlabs/looma 0.23.13 → 0.23.14

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.
@@ -9561,10 +9561,10 @@ function arrayEquals(left, right) {
9561
9561
  }
9562
9562
  function readRenderedColumnWidths(tableElement) {
9563
9563
  const colElements = Array.from(tableElement.querySelectorAll("colgroup col"));
9564
- if (colElements.length > 0) return colElements.map((column) => Math.max(1, Math.round(column.getBoundingClientRect().width)));
9564
+ if (colElements.length > 0) return colElements.map((column) => Math.max(1, column.getBoundingClientRect().width));
9565
9565
  const firstRow = tableElement.rows.item(0);
9566
9566
  if (!firstRow) return [];
9567
- return Array.from(firstRow.cells).map((cell) => Math.max(1, Math.round(cell.getBoundingClientRect().width)));
9567
+ return Array.from(firstRow.cells).map((cell) => Math.max(1, cell.getBoundingClientRect().width));
9568
9568
  }
9569
9569
  function distributeWidthDelta(widths, availableWidth, minWidth) {
9570
9570
  const normalized = [...widths];
@@ -9672,8 +9672,8 @@ function insertTableAtRange(editor, range, options = {}) {
9672
9672
  * Browser layout is the source of truth at the end of a pointer resize, but
9673
9673
  * ProseMirror must persist integer widths in the document. The algorithm keeps
9674
9674
  * proportions, enforces a minimum, and distributes rounding error so the final
9675
- * sum still equals the rendered table width. Spanning cells are updated once at
9676
- * their top-left map coordinate rather than once per covered grid position.
9675
+ * sum fits the rendered column grid, excluding the outer table border. Spanning
9676
+ * cells are updated once at their top-left map coordinate rather than once per covered grid position.
9677
9677
  *
9678
9678
  * @invariant Every persisted width is an integer at least `minWidth`, and each
9679
9679
  * spanning cell receives one width per logical column from its top-left origin.
@@ -9685,7 +9685,7 @@ function normalizeActiveTableColumnWidths(editor, tableElement, minWidth = 25) {
9685
9685
  if (!tableInfo) return false;
9686
9686
  const renderedColumnWidths = readRenderedColumnWidths(tableElement);
9687
9687
  if (renderedColumnWidths.length === 0) return false;
9688
- const normalizedColumnWidths = normalizeColumnWidths(renderedColumnWidths, Math.max(1, Math.round(tableElement.getBoundingClientRect().width)), minWidth);
9688
+ const normalizedColumnWidths = normalizeColumnWidths(renderedColumnWidths, Math.max(1, Math.floor(renderedColumnWidths.reduce((sum, width) => sum + width, 0))), minWidth);
9689
9689
  const { pos: tablePos, node: table } = tableInfo;
9690
9690
  const map = TableMap.get(table);
9691
9691
  const tableStart = tablePos + 1;
@@ -95,8 +95,8 @@ export declare function insertTableAtRange(editor: Editor, range: Range, options
95
95
  * Browser layout is the source of truth at the end of a pointer resize, but
96
96
  * ProseMirror must persist integer widths in the document. The algorithm keeps
97
97
  * proportions, enforces a minimum, and distributes rounding error so the final
98
- * sum still equals the rendered table width. Spanning cells are updated once at
99
- * their top-left map coordinate rather than once per covered grid position.
98
+ * sum fits the rendered column grid, excluding the outer table border. Spanning
99
+ * cells are updated once at their top-left map coordinate rather than once per covered grid position.
100
100
  *
101
101
  * @invariant Every persisted width is an integer at least `minWidth`, and each
102
102
  * spanning cell receives one width per logical column from its top-left origin.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.23.13",
3
+ "version": "0.23.14",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",