blitz-pdf 0.1.2 → 0.1.3

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 CHANGED
@@ -431,6 +431,32 @@ relaxed to make progress. A text line that cannot fit the printable height
431
431
  fails explicitly. Keep-with-next protects a heading even when the following
432
432
  paragraph spans multiple pages.
433
433
 
434
+ Trailing `<br>` elements and preserved blank lines keep their layout height;
435
+ the extra cursor line emitted by the text engine after a final break is not
436
+ paginated. Overflow clips constrain line, glyph, and table-row fragmentation.
437
+ Fully clipped glyph runs are omitted from the PDF's selectable text.
438
+
439
+ Pagination failures include a code at the start of `Error.message`:
440
+
441
+ - `PAGINATION_LINE_TOO_TALL`: a line exceeds the available printable height.
442
+ - `PAGINATION_NO_PROGRESS`: no valid advancing break exists, including chains
443
+ of overlapping lines that individually fit the page.
444
+ - `PAGINATION_FORCED_BREAK_INTERSECTS_LINE`: an explicit break cuts a line.
445
+ - `PAGINATION_TABLE_GROUPS_TOO_TALL`: repeated groups leave no room for rows.
446
+
447
+ These messages include the zero-based page index, document-space page top,
448
+ available height, and, when associated with a DOM line, element tag/ID, internal
449
+ node ID, zero-based line index and measured visible line range. Coordinates and
450
+ heights are CSS pixels. Painted glyph runs without a DOM association and errors
451
+ without a blocking line report those fields as `unavailable`.
452
+
453
+ The pinned Blitz table layout still differs from Chromium for `td { max-width: 0 }`:
454
+ it can constrain the cell itself to zero content width and wrap short text by
455
+ character, while Chromium distributes the table width across the columns.
456
+ Height-limited containers now paginate their visible content without failing,
457
+ but this does not resolve that separate width-compatibility issue. See the
458
+ [reproduction and investigation](docs/pagination-regressions.md).
459
+
434
460
  The first `<thead>` and `<tfoot>` (or elements styled as `table-header-group`
435
461
  and `table-footer-group`) repeat on every fragment of their table. Their actual
436
462
  layout, column widths, backgrounds, and selectable text are retained. Use
@@ -0,0 +1,88 @@
1
+ # Pagination regressions in 0.1.2
2
+
3
+ The regressions are exercised through `renderPdf` in `tests/pagination.test.ts`.
4
+ Rebuild the WASM before running them.
5
+
6
+ ## Final breaks and empty lines
7
+
8
+ ```js
9
+ await renderPdf("<p>Text<br></p>", { format: "A4" });
10
+ ```
11
+
12
+ With the pinned Blitz `e72650a` and Parley 0.12.0, instrumenting this layout
13
+ shows a paragraph height of 19 CSS pixels. Parley supplies two line ranges:
14
+ `[0, 19]` for `Text\n`, and `[19, 38]` with an empty text range and no positioned
15
+ items. Both have a finite, ordinary line height of 19 pixels.
16
+
17
+ Blitz's `packages/blitz-dom/src/layout/inline.rs` excludes that second line
18
+ from the block's height: it exists to position an editor cursor after a final
19
+ newline, not as another CSS line box. Pagination previously kept it. With the
20
+ default paragraph margins, the document ends inside this extra line; repeated
21
+ attempts to move the break backward eventually stop making progress. The old
22
+ error incorrectly classified this as a line taller than A4.
23
+
24
+ `css_lines` now uses the same terminal-line test as Blitz, including for
25
+ keep-with-next edges and widow/orphan counts. A real blank line has a newline in
26
+ its text range and remains in pagination with its measured line box. No text,
27
+ invisible anchor, or other character is inserted. Position assertions cover
28
+ multiple blank lines, table cells, and automatic/forced page boundaries.
29
+
30
+ ## Height-limited tables
31
+
32
+ Use the following HTML in both a browser and `renderPdf(html, { format: "A4" })`:
33
+
34
+ ```html
35
+ <style>
36
+ .info { width: 75mm; max-height: 75mm; overflow: hidden; }
37
+ .info table { width: 100%; border-collapse: collapse; }
38
+ .info td {
39
+ max-width: 0;
40
+ word-break: break-all;
41
+ overflow-wrap: break-word;
42
+ }
43
+ </style>
44
+ <div class="info">
45
+ <table>
46
+ <tr><td>Text</td><td>Text</td></tr>
47
+ <tr><td>Text</td><td>Text</td></tr>
48
+ <tr><td>Text</td><td>Text</td></tr>
49
+ <tr><td>Text</td><td>Text</td></tr>
50
+ <tr><td>Text</td><td>Text</td></tr>
51
+ <tr><td>Text</td><td>Text</td></tr>
52
+ </table>
53
+ </div>
54
+ ```
55
+
56
+ Measured in Chromium 154 on macOS, `getBoundingClientRect()` gives a table
57
+ width of about 283.46 pixels, cell widths of about 141.73 pixels and a total
58
+ height of 123 pixels. Changing `max-width` to `none` produces the same
59
+ dimensions for these equal cell contents.
60
+
61
+ Blitz's final cell layout instead has width 2 pixels (zero content width plus
62
+ padding), height 78 pixels, and four 19-pixel lines for `Text`. Its table grid
63
+ adapts cells to grid items while retaining `max_size.width`; the inline layout
64
+ therefore receives a zero-width constraint. This confirms a browser
65
+ compatibility difference. It does not establish a general correction to the
66
+ CSS table-width algorithm, which remains a separate upstream task.
67
+
68
+ The resulting tall table exceeds its container's height. Pagination previously
69
+ used line and row ranges beyond the overflow clip; the document end inside a
70
+ clipped line could cause the same misleading error as the first reproduction.
71
+ Pagination now clips those ranges to the visible padding box and intersects
72
+ glyph bounds with the scene's nested clips. PDF text emission uses the same
73
+ clip bounds to omit fully hidden runs. Regression coverage includes both
74
+ `max-width` values, nested `hidden`/`clip` containers and clipped oversized ink.
75
+
76
+ The zero-width case now exports, but its column widths still differ from the
77
+ browser. Its test deliberately does not claim that all twelve cells are visible.
78
+
79
+ ## Diagnostic distinctions
80
+
81
+ `PAGINATION_LINE_TOO_TALL` requires a blocking line whose visible height exceeds
82
+ the available height. `PAGINATION_NO_PROGRESS` covers, for example, staggered
83
+ columns of overlapping 40-pixel lines on an 80-pixel page. A forced break through
84
+ a line has its own `PAGINATION_FORCED_BREAK_INTERSECTS_LINE` code. Tests assert
85
+ the element, page/line indexes, available height and line range, and verify that
86
+ rendering remains usable after an error.
87
+
88
+ The Argon asset-path issue is outside this change.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blitz-pdf",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Render HTML and CSS to PDF with Blitz and WebAssembly in Node.js, Bun, and browsers.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -47,6 +47,7 @@
47
47
  "dist",
48
48
  "wasm",
49
49
  "src",
50
+ "docs",
50
51
  "examples",
51
52
  "assets/icon.svg",
52
53
  "README.md",
Binary file