@cj-tech-master/excelts 9.5.2 → 9.5.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.
@@ -37,15 +37,10 @@ export function renderPage(page, options, fontManager, totalPages) {
37
37
  drawCellFill(stream, cell, alphaValues);
38
38
  }
39
39
  }
40
- // --- Step 3: Draw cell borders ---
41
- for (const cell of page.cells) {
42
- drawCellBorders(stream, cell);
43
- }
44
- // --- Step 3.5: Erase grid lines and borders in text overflow regions ---
45
- // In Excel, text overflowing into adjacent empty cells hides gridlines and
46
- // borders underneath. We draw white only over the portions of the overflow
47
- // area that do NOT have a cell fill (cells with fill already cover gridlines
48
- // in Step 2, and we must not erase their background).
40
+ // --- Step 3: Erase grid lines in text overflow regions ---
41
+ // In Excel, text overflowing into adjacent empty cells hides gridlines
42
+ // underneath. We draw white over the overflow area before drawing borders
43
+ // so that borders remain crisp and unaffected.
49
44
  for (const cell of page.cells) {
50
45
  if (!cell.textOverflowWidth || cell.textOverflowWidth <= 0) {
51
46
  continue;
@@ -76,17 +71,9 @@ export function renderPage(page, options, fontManager, totalPages) {
76
71
  });
77
72
  }
78
73
  }
79
- // Draw white in unfilled portions of the overflow area.
80
- // Inset vertically by a small amount to avoid covering the horizontal
81
- // border lines at the top/bottom edges of the cell.
82
- const borderInset = 0.25;
83
- const eraseY = cellY + borderInset;
84
- const eraseH = cellH - borderInset * 2;
85
- if (eraseH <= 0) {
86
- continue;
87
- }
74
+ // Draw white in unfilled portions of the overflow area
88
75
  if (filledRanges.length === 0) {
89
- stream.fillRect(overflowLeft, eraseY, cell.textOverflowWidth, eraseH, { r: 1, g: 1, b: 1 });
76
+ stream.fillRect(overflowLeft, cellY, cell.textOverflowWidth, cellH, { r: 1, g: 1, b: 1 });
90
77
  }
91
78
  else {
92
79
  // Sort filled ranges and draw white in gaps
@@ -94,16 +81,20 @@ export function renderPage(page, options, fontManager, totalPages) {
94
81
  let cursor = overflowLeft;
95
82
  for (const fr of filledRanges) {
96
83
  if (fr.left > cursor) {
97
- stream.fillRect(cursor, eraseY, fr.left - cursor, eraseH, { r: 1, g: 1, b: 1 });
84
+ stream.fillRect(cursor, cellY, fr.left - cursor, cellH, { r: 1, g: 1, b: 1 });
98
85
  }
99
86
  cursor = Math.max(cursor, fr.right);
100
87
  }
101
88
  if (cursor < overflowRight) {
102
- stream.fillRect(cursor, eraseY, overflowRight - cursor, eraseH, { r: 1, g: 1, b: 1 });
89
+ stream.fillRect(cursor, cellY, overflowRight - cursor, cellH, { r: 1, g: 1, b: 1 });
103
90
  }
104
91
  }
105
92
  }
106
- // --- Step 4: Draw cell text ---
93
+ // --- Step 4: Draw cell borders (after overflow erase so borders stay crisp) ---
94
+ for (const cell of page.cells) {
95
+ drawCellBorders(stream, cell);
96
+ }
97
+ // --- Step 5: Draw cell text ---
107
98
  const sf = page.scaleFactor;
108
99
  for (const cell of page.cells) {
109
100
  if (cell.text || cell.richText) {
@@ -572,8 +572,11 @@ export class Readable extends EventEmitter {
572
572
  // Binary mode
573
573
  let result;
574
574
  if (n == null) {
575
- // read() with no size: return ALL buffered data as one chunk
576
- result = this._applyEncoding(this._buf.consumeAll());
575
+ // read() with no size: return one chunk from the buffer.
576
+ // Node.js 26+ returns a single chunk rather than concatenating all
577
+ // buffered data. This matches native behavior and avoids unnecessary
578
+ // allocations when consumers iterate with while(chunk = read()).
579
+ result = this._applyEncoding(this._buf.shift());
577
580
  }
578
581
  else {
579
582
  // read(n): return exactly n bytes, or null if not enough
@@ -46,15 +46,10 @@ function renderPage(page, options, fontManager, totalPages) {
46
46
  drawCellFill(stream, cell, alphaValues);
47
47
  }
48
48
  }
49
- // --- Step 3: Draw cell borders ---
50
- for (const cell of page.cells) {
51
- drawCellBorders(stream, cell);
52
- }
53
- // --- Step 3.5: Erase grid lines and borders in text overflow regions ---
54
- // In Excel, text overflowing into adjacent empty cells hides gridlines and
55
- // borders underneath. We draw white only over the portions of the overflow
56
- // area that do NOT have a cell fill (cells with fill already cover gridlines
57
- // in Step 2, and we must not erase their background).
49
+ // --- Step 3: Erase grid lines in text overflow regions ---
50
+ // In Excel, text overflowing into adjacent empty cells hides gridlines
51
+ // underneath. We draw white over the overflow area before drawing borders
52
+ // so that borders remain crisp and unaffected.
58
53
  for (const cell of page.cells) {
59
54
  if (!cell.textOverflowWidth || cell.textOverflowWidth <= 0) {
60
55
  continue;
@@ -85,17 +80,9 @@ function renderPage(page, options, fontManager, totalPages) {
85
80
  });
86
81
  }
87
82
  }
88
- // Draw white in unfilled portions of the overflow area.
89
- // Inset vertically by a small amount to avoid covering the horizontal
90
- // border lines at the top/bottom edges of the cell.
91
- const borderInset = 0.25;
92
- const eraseY = cellY + borderInset;
93
- const eraseH = cellH - borderInset * 2;
94
- if (eraseH <= 0) {
95
- continue;
96
- }
83
+ // Draw white in unfilled portions of the overflow area
97
84
  if (filledRanges.length === 0) {
98
- stream.fillRect(overflowLeft, eraseY, cell.textOverflowWidth, eraseH, { r: 1, g: 1, b: 1 });
85
+ stream.fillRect(overflowLeft, cellY, cell.textOverflowWidth, cellH, { r: 1, g: 1, b: 1 });
99
86
  }
100
87
  else {
101
88
  // Sort filled ranges and draw white in gaps
@@ -103,16 +90,20 @@ function renderPage(page, options, fontManager, totalPages) {
103
90
  let cursor = overflowLeft;
104
91
  for (const fr of filledRanges) {
105
92
  if (fr.left > cursor) {
106
- stream.fillRect(cursor, eraseY, fr.left - cursor, eraseH, { r: 1, g: 1, b: 1 });
93
+ stream.fillRect(cursor, cellY, fr.left - cursor, cellH, { r: 1, g: 1, b: 1 });
107
94
  }
108
95
  cursor = Math.max(cursor, fr.right);
109
96
  }
110
97
  if (cursor < overflowRight) {
111
- stream.fillRect(cursor, eraseY, overflowRight - cursor, eraseH, { r: 1, g: 1, b: 1 });
98
+ stream.fillRect(cursor, cellY, overflowRight - cursor, cellH, { r: 1, g: 1, b: 1 });
112
99
  }
113
100
  }
114
101
  }
115
- // --- Step 4: Draw cell text ---
102
+ // --- Step 4: Draw cell borders (after overflow erase so borders stay crisp) ---
103
+ for (const cell of page.cells) {
104
+ drawCellBorders(stream, cell);
105
+ }
106
+ // --- Step 5: Draw cell text ---
116
107
  const sf = page.scaleFactor;
117
108
  for (const cell of page.cells) {
118
109
  if (cell.text || cell.richText) {
@@ -577,8 +577,11 @@ class Readable extends event_emitter_1.EventEmitter {
577
577
  // Binary mode
578
578
  let result;
579
579
  if (n == null) {
580
- // read() with no size: return ALL buffered data as one chunk
581
- result = this._applyEncoding(this._buf.consumeAll());
580
+ // read() with no size: return one chunk from the buffer.
581
+ // Node.js 26+ returns a single chunk rather than concatenating all
582
+ // buffered data. This matches native behavior and avoids unnecessary
583
+ // allocations when consumers iterate with while(chunk = read()).
584
+ result = this._applyEncoding(this._buf.shift());
582
585
  }
583
586
  else {
584
587
  // read(n): return exactly n bytes, or null if not enough
@@ -37,15 +37,10 @@ export function renderPage(page, options, fontManager, totalPages) {
37
37
  drawCellFill(stream, cell, alphaValues);
38
38
  }
39
39
  }
40
- // --- Step 3: Draw cell borders ---
41
- for (const cell of page.cells) {
42
- drawCellBorders(stream, cell);
43
- }
44
- // --- Step 3.5: Erase grid lines and borders in text overflow regions ---
45
- // In Excel, text overflowing into adjacent empty cells hides gridlines and
46
- // borders underneath. We draw white only over the portions of the overflow
47
- // area that do NOT have a cell fill (cells with fill already cover gridlines
48
- // in Step 2, and we must not erase their background).
40
+ // --- Step 3: Erase grid lines in text overflow regions ---
41
+ // In Excel, text overflowing into adjacent empty cells hides gridlines
42
+ // underneath. We draw white over the overflow area before drawing borders
43
+ // so that borders remain crisp and unaffected.
49
44
  for (const cell of page.cells) {
50
45
  if (!cell.textOverflowWidth || cell.textOverflowWidth <= 0) {
51
46
  continue;
@@ -76,17 +71,9 @@ export function renderPage(page, options, fontManager, totalPages) {
76
71
  });
77
72
  }
78
73
  }
79
- // Draw white in unfilled portions of the overflow area.
80
- // Inset vertically by a small amount to avoid covering the horizontal
81
- // border lines at the top/bottom edges of the cell.
82
- const borderInset = 0.25;
83
- const eraseY = cellY + borderInset;
84
- const eraseH = cellH - borderInset * 2;
85
- if (eraseH <= 0) {
86
- continue;
87
- }
74
+ // Draw white in unfilled portions of the overflow area
88
75
  if (filledRanges.length === 0) {
89
- stream.fillRect(overflowLeft, eraseY, cell.textOverflowWidth, eraseH, { r: 1, g: 1, b: 1 });
76
+ stream.fillRect(overflowLeft, cellY, cell.textOverflowWidth, cellH, { r: 1, g: 1, b: 1 });
90
77
  }
91
78
  else {
92
79
  // Sort filled ranges and draw white in gaps
@@ -94,16 +81,20 @@ export function renderPage(page, options, fontManager, totalPages) {
94
81
  let cursor = overflowLeft;
95
82
  for (const fr of filledRanges) {
96
83
  if (fr.left > cursor) {
97
- stream.fillRect(cursor, eraseY, fr.left - cursor, eraseH, { r: 1, g: 1, b: 1 });
84
+ stream.fillRect(cursor, cellY, fr.left - cursor, cellH, { r: 1, g: 1, b: 1 });
98
85
  }
99
86
  cursor = Math.max(cursor, fr.right);
100
87
  }
101
88
  if (cursor < overflowRight) {
102
- stream.fillRect(cursor, eraseY, overflowRight - cursor, eraseH, { r: 1, g: 1, b: 1 });
89
+ stream.fillRect(cursor, cellY, overflowRight - cursor, cellH, { r: 1, g: 1, b: 1 });
103
90
  }
104
91
  }
105
92
  }
106
- // --- Step 4: Draw cell text ---
93
+ // --- Step 4: Draw cell borders (after overflow erase so borders stay crisp) ---
94
+ for (const cell of page.cells) {
95
+ drawCellBorders(stream, cell);
96
+ }
97
+ // --- Step 5: Draw cell text ---
107
98
  const sf = page.scaleFactor;
108
99
  for (const cell of page.cells) {
109
100
  if (cell.text || cell.richText) {
@@ -572,8 +572,11 @@ export class Readable extends EventEmitter {
572
572
  // Binary mode
573
573
  let result;
574
574
  if (n == null) {
575
- // read() with no size: return ALL buffered data as one chunk
576
- result = this._applyEncoding(this._buf.consumeAll());
575
+ // read() with no size: return one chunk from the buffer.
576
+ // Node.js 26+ returns a single chunk rather than concatenating all
577
+ // buffered data. This matches native behavior and avoids unnecessary
578
+ // allocations when consumers iterate with while(chunk = read()).
579
+ result = this._applyEncoding(this._buf.shift());
577
580
  }
578
581
  else {
579
582
  // read(n): return exactly n bytes, or null if not enough
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v9.5.2
2
+ * @cj-tech-master/excelts v9.5.3
3
3
  * Zero-dependency TypeScript toolkit — Excel (XLSX), PDF, CSV, Markdown, XML, ZIP/TAR, and streaming.
4
4
  * (c) 2026 cjnoname
5
5
  * Released under the MIT License
@@ -4365,7 +4365,7 @@ var ExcelTS = (function(exports) {
4365
4365
  return chunk;
4366
4366
  }
4367
4367
  let result;
4368
- if (n == null) result = this._applyEncoding(this._buf.consumeAll());
4368
+ if (n == null) result = this._applyEncoding(this._buf.shift());
4369
4369
  else if (this._buf.byteSize < n) if (this._ended) result = this._applyEncoding(this._buf.consumeAll());
4370
4370
  else {
4371
4371
  if (this._hasReadImpl && this._constructed) this._callRead(Math.max(n, this._highWaterMark));
@@ -87259,7 +87259,6 @@ self.onmessage = async function(event) {
87259
87259
  const alphaValues = /* @__PURE__ */ new Set();
87260
87260
  if (options.showGridLines) drawGridLines(stream, page, options);
87261
87261
  for (const cell of page.cells) if (cell.fillColor) drawCellFill(stream, cell, alphaValues);
87262
- for (const cell of page.cells) drawCellBorders(stream, cell);
87263
87262
  for (const cell of page.cells) {
87264
87263
  if (!cell.textOverflowWidth || cell.textOverflowWidth <= 0) continue;
87265
87264
  const overflowLeft = cell.rect.x + cell.rect.width;
@@ -87277,11 +87276,7 @@ self.onmessage = async function(event) {
87277
87276
  right: Math.min(oRight, overflowRight)
87278
87277
  });
87279
87278
  }
87280
- const borderInset = .25;
87281
- const eraseY = cellY + borderInset;
87282
- const eraseH = cellH - borderInset * 2;
87283
- if (eraseH <= 0) continue;
87284
- if (filledRanges.length === 0) stream.fillRect(overflowLeft, eraseY, cell.textOverflowWidth, eraseH, {
87279
+ if (filledRanges.length === 0) stream.fillRect(overflowLeft, cellY, cell.textOverflowWidth, cellH, {
87285
87280
  r: 1,
87286
87281
  g: 1,
87287
87282
  b: 1
@@ -87290,20 +87285,21 @@ self.onmessage = async function(event) {
87290
87285
  filledRanges.sort((a, b) => a.left - b.left);
87291
87286
  let cursor = overflowLeft;
87292
87287
  for (const fr of filledRanges) {
87293
- if (fr.left > cursor) stream.fillRect(cursor, eraseY, fr.left - cursor, eraseH, {
87288
+ if (fr.left > cursor) stream.fillRect(cursor, cellY, fr.left - cursor, cellH, {
87294
87289
  r: 1,
87295
87290
  g: 1,
87296
87291
  b: 1
87297
87292
  });
87298
87293
  cursor = Math.max(cursor, fr.right);
87299
87294
  }
87300
- if (cursor < overflowRight) stream.fillRect(cursor, eraseY, overflowRight - cursor, eraseH, {
87295
+ if (cursor < overflowRight) stream.fillRect(cursor, cellY, overflowRight - cursor, cellH, {
87301
87296
  r: 1,
87302
87297
  g: 1,
87303
87298
  b: 1
87304
87299
  });
87305
87300
  }
87306
87301
  }
87302
+ for (const cell of page.cells) drawCellBorders(stream, cell);
87307
87303
  const sf = page.scaleFactor;
87308
87304
  for (const cell of page.cells) if (cell.text || cell.richText) drawCellText(stream, cell, fontManager, alphaValues, sf);
87309
87305
  if (options.showSheetNames) drawPageHeader(stream, page, options, fontManager);