javascript-excel 2.0.0-alpha.1 → 2.0.0-alpha.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.
Files changed (71) hide show
  1. package/README.md +164 -15
  2. package/dist/address-DUn7-5OS.js +75 -0
  3. package/dist/address-DZBHchLv.cjs +122 -0
  4. package/dist/{auto-width-2oBzjeNG.d.cts → auto-width-DRHsPKNk.d.cts} +1 -1
  5. package/dist/cells-CPXU722t.cjs +33 -0
  6. package/dist/cells-CrMF8h_t.js +28 -0
  7. package/dist/colors-B8Nf_xTx.js +114 -0
  8. package/dist/colors-oBpjx97l.cjs +119 -0
  9. package/dist/csv-DyVH9y7S.cjs +647 -0
  10. package/dist/csv-pXfaputs.js +618 -0
  11. package/dist/csv.cjs +6 -622
  12. package/dist/csv.d.cts +4 -1
  13. package/dist/csv.d.ts +4 -1
  14. package/dist/csv.js +1 -618
  15. package/dist/dataset-KeMzHCGl.js +664 -0
  16. package/dist/dataset-UUZCzsi3.cjs +687 -0
  17. package/dist/dates-BXcSWf9_.js +64 -0
  18. package/dist/dates-CA1dCizp.cjs +75 -0
  19. package/dist/dom.cjs +7 -28
  20. package/dist/dom.d.cts +5 -2
  21. package/dist/dom.d.ts +4 -1
  22. package/dist/dom.js +6 -27
  23. package/dist/{numfmt-B-TlCgr7.cjs → dos-time-FZ7-1tot.cjs} +36 -199
  24. package/dist/{numfmt-DEm0sYBJ.js → dos-time-dD0z1YWU.js} +36 -181
  25. package/dist/format.cjs +1264 -0
  26. package/dist/format.d.cts +59 -0
  27. package/dist/format.d.ts +59 -0
  28. package/dist/format.js +1262 -0
  29. package/dist/import.cjs +10 -0
  30. package/dist/import.d.cts +10 -0
  31. package/dist/import.d.ts +10 -0
  32. package/dist/import.js +1 -0
  33. package/dist/index.cjs +28 -1408
  34. package/dist/index.d.cts +149 -8
  35. package/dist/index.d.ts +148 -7
  36. package/dist/index.js +11 -1395
  37. package/dist/iso-date-3TY1OlGd.cjs +57 -0
  38. package/dist/iso-date-CXnn-9mT.js +46 -0
  39. package/dist/{warnings-C_12PT4t.d.cts → model-0JikLfuM.d.cts} +1 -41
  40. package/dist/{warnings-DXJKe1lx.d.ts → model-0JikLfuM.d.ts} +1 -41
  41. package/dist/numfmt-BmEbm78Y.cjs +125 -0
  42. package/dist/numfmt-DCDrX9P1.js +114 -0
  43. package/dist/pipeline-BAJtzBdW.js +1085 -0
  44. package/dist/pipeline-Bnf7EU3X.cjs +1132 -0
  45. package/dist/pipeline-CctEa86r.d.cts +186 -0
  46. package/dist/pipeline-I8SLmV9S.d.ts +186 -0
  47. package/dist/read-CZEWV4rK.cjs +3096 -0
  48. package/dist/read-LWti17lz.js +3073 -0
  49. package/dist/read.cjs +5 -2898
  50. package/dist/read.d.cts +13 -12
  51. package/dist/read.d.ts +13 -12
  52. package/dist/read.js +1 -2895
  53. package/dist/render.cjs +751 -0
  54. package/dist/render.d.cts +215 -0
  55. package/dist/render.d.ts +215 -0
  56. package/dist/render.js +732 -0
  57. package/dist/{sheet-names-CDsVK15c.js → sheet-names-7p-joVsG.js} +4 -102
  58. package/dist/{sheet-names-Cm-IhbBk.cjs → sheet-names-B8U5RAW0.cjs} +16 -168
  59. package/dist/warnings-B1v58nCZ.d.cts +41 -0
  60. package/dist/warnings-B1v58nCZ.d.ts +41 -0
  61. package/dist/worker.cjs +244 -7
  62. package/dist/worker.d.cts +68 -5
  63. package/dist/worker.d.ts +68 -5
  64. package/dist/worker.js +243 -7
  65. package/dist/{write-CYpLGuzl.d.ts → write-DM6ieuQY.d.ts} +2 -1
  66. package/dist/write-DjgWy1PK.js +1473 -0
  67. package/dist/{write-C5JgeIar.d.cts → write-DtjfdIFm.d.cts} +2 -1
  68. package/dist/write-f9kcYf5K.cjs +1490 -0
  69. package/package.json +77 -12
  70. package/dist/iso-date-B22IvwL1.js +0 -21
  71. package/dist/iso-date-BSUsPSWO.cjs +0 -26
@@ -1,5 +1,5 @@
1
1
  import { o as ValidationError } from "./errors-CvGlfw0E.js";
2
- import { t as isoDate } from "./iso-date-B22IvwL1.js";
2
+ import { a as decodeRange, i as decodeCol, n as MAX_ROWS, o as encodeCell, r as decodeCell, s as encodeCol, t as MAX_COLS } from "./address-DUn7-5OS.js";
3
3
  // src/internal/xml.ts
4
4
  /**
5
5
  * XML text helpers for the writer.
@@ -50,8 +50,9 @@ function xmlAttr(s) {
50
50
  return s.replace(INVALID_XML_CHAR, "").replace(MARKUP_ATTR, entity);
51
51
  }
52
52
  /** True when text needs `xml:space="preserve"` to keep its whitespace. */
53
+ const WS = /\s/;
53
54
  function needsPreserve(s) {
54
- return s.length > 0 && (/^\s/.test(s) || /\s$/.test(s) || s.includes("\n") || s.includes(" "));
55
+ return s.length > 0 && (WS.test(s[0]) || WS.test(s[s.length - 1]) || s.includes("\n") || s.includes(" "));
55
56
  }
56
57
  const XML_DECL = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
57
58
  /**
@@ -61,79 +62,6 @@ const XML_DECL = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
61
62
  function num(n) {
62
63
  return Object.is(n, -0) ? "0" : String(n);
63
64
  }
64
- // src/address.ts
65
- /**
66
- * A1 address helpers (docs/api.md §4.1). Indices are zero-based.
67
- */
68
- /** Rows per sheet in the xlsx format. */
69
- const MAX_ROWS = 1048576;
70
- /** Columns per sheet in the xlsx format (A..XFD). */
71
- const MAX_COLS = 16384;
72
- function invalidRef(ref, why) {
73
- return new ValidationError("INVALID_REF", `Invalid reference ${JSON.stringify(ref)}: ${why}.`, { details: { ref } });
74
- }
75
- function checkIndex(n, max, what) {
76
- if (!Number.isInteger(n) || n < 0 || n >= max) throw new ValidationError("OUT_OF_BOUNDS", `${what} index ${n} is outside 0..${max - 1}.`, { details: {
77
- index: n,
78
- max: max - 1
79
- } });
80
- }
81
- /** Column index to letters: 0 → 'A', 16383 → 'XFD'. */
82
- function encodeCol(col) {
83
- checkIndex(col, MAX_COLS, "Column");
84
- let s = "";
85
- for (let n = col + 1; n > 0; n = Math.floor((n - 1) / 26)) s = String.fromCharCode(65 + (n - 1) % 26) + s;
86
- return s;
87
- }
88
- /** Column letters to index: 'A' → 0, 'XFD' → 16383. Case-insensitive. */
89
- function decodeCol(letters) {
90
- if (typeof letters !== "string" || !/^[A-Za-z]{1,3}$/.test(letters)) throw invalidRef(letters, "expected column letters");
91
- let n = 0;
92
- for (const ch of letters.toUpperCase()) n = n * 26 + (ch.charCodeAt(0) - 64);
93
- if (n > 16384) throw invalidRef(letters, "beyond column XFD");
94
- return n - 1;
95
- }
96
- /** { row: 0, col: 1 } → 'B1'. */
97
- function encodeCell(a) {
98
- checkIndex(a.row, MAX_ROWS, "Row");
99
- return encodeCol(a.col) + String(a.row + 1);
100
- }
101
- const CELL_RE = /^\$?([A-Za-z]{1,3})\$?([1-9][0-9]{0,6})$/;
102
- /** 'B1' or '$B$1' → { row: 0, col: 1 }. */
103
- function decodeCell(ref) {
104
- const m = typeof ref === "string" ? CELL_RE.exec(ref) : null;
105
- if (!m) throw invalidRef(ref, "expected an A1 cell reference");
106
- const row = Number(m[2]) - 1;
107
- if (row >= 1048576) throw invalidRef(ref, "beyond row 1048576");
108
- return {
109
- row,
110
- col: decodeCol(m[1])
111
- };
112
- }
113
- /** Range to 'A1:C3' (a single cell gives 'A1'). */
114
- function encodeRange(r) {
115
- const a = encodeCell(r.start);
116
- const b = encodeCell(r.end);
117
- return a === b ? a : `${a}:${b}`;
118
- }
119
- /** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
120
- function decodeRange(ref) {
121
- if (typeof ref !== "string") throw invalidRef(ref, "expected an A1 range");
122
- const parts = ref.split(":");
123
- if (parts.length > 2) throw invalidRef(ref, "expected an A1 range");
124
- const a = decodeCell(parts[0]);
125
- const b = parts.length === 2 ? decodeCell(parts[1]) : a;
126
- return {
127
- start: {
128
- row: Math.min(a.row, b.row),
129
- col: Math.min(a.col, b.col)
130
- },
131
- end: {
132
- row: Math.max(a.row, b.row),
133
- col: Math.max(a.col, b.col)
134
- }
135
- };
136
- }
137
65
  // src/styles.ts
138
66
  /** Copies `b`'s defined fields over a copy of `a`. */
139
67
  function mergeFields(a, b) {
@@ -180,32 +108,6 @@ function mergeStyles(...styles) {
180
108
  }
181
109
  return out;
182
110
  }
183
- // src/cells.ts
184
- /**
185
- * Cell helpers (docs/api.md §4.2).
186
- */
187
- function valueText(v, zone) {
188
- if (v === null || v === void 0) return "";
189
- if (typeof v === "string") return v;
190
- if (typeof v === "number") return String(v);
191
- if (typeof v === "boolean") return v ? "TRUE" : "FALSE";
192
- if (v instanceof Date) return Number.isFinite(v.getTime()) ? isoDate(v, zone) : "";
193
- if (typeof v === "object" && "error" in v) return String(v.error);
194
- if (typeof v === "object" && "richText" in v && Array.isArray(v.richText)) return v.richText.map((r) => r.text).join("");
195
- return "";
196
- }
197
- /**
198
- * Plain text of a cell: strings as they are, numbers as `String(n)`, booleans
199
- * as TRUE/FALSE, dates as ISO 8601, errors as their code, rich text joined.
200
- * A formula cell gives its cached value's text ('' when there is none).
201
- * Number formats are not applied.
202
- */
203
- function cellText(cell, options) {
204
- const zone = options?.dateZone ?? "local";
205
- if (cell === null || cell === void 0) return "";
206
- if (typeof cell !== "object" || cell instanceof Date || "error" in cell || "richText" in cell) return valueText(cell, zone);
207
- return valueText(cell.value, zone);
208
- }
209
111
  // src/internal/write/package.ts
210
112
  /**
211
113
  * The OPC package: which parts exist, their content types and the
@@ -828,4 +730,4 @@ function sanitizeSheetName(name) {
828
730
  }
829
731
  return s.length === 0 || s.toLowerCase() === "history" ? "Sheet" : s;
830
732
  }
831
- export { encodeRange as C, xmlAttr as D, num as E, xmlText as O, encodeCol as S, needsPreserve as T, MAX_ROWS as _, SheetFeatures as a, decodeRange as b, hyperlinkSchemes as c, PackageParts as d, REL_TYPE as f, MAX_COLS as g, mergeStyles as h, DEFAULT_HYPERLINK_SCHEMES as i, xstring as k, textWidth as l, cellText as m, validateSheetName as n, SheetLinks as o, Rels as p, AUTO_WIDTH as r, hyperlinkOf as s, sanitizeSheetName as t, CONTENT_TYPE as u, decodeCell as v, XML_DECL as w, encodeCell as x, decodeCol as y };
733
+ export { num as _, SheetFeatures as a, xstring as b, hyperlinkSchemes as c, PackageParts as d, REL_TYPE as f, needsPreserve as g, XML_DECL as h, DEFAULT_HYPERLINK_SCHEMES as i, textWidth as l, mergeStyles as m, validateSheetName as n, SheetLinks as o, Rels as p, AUTO_WIDTH as r, hyperlinkOf as s, sanitizeSheetName as t, CONTENT_TYPE as u, xmlAttr as v, xmlText as y };
@@ -1,5 +1,5 @@
1
1
  const require_errors = require("./errors-DOPrrGS4.cjs");
2
- const require_iso_date = require("./iso-date-BSUsPSWO.cjs");
2
+ const require_address = require("./address-DZBHchLv.cjs");
3
3
  // src/internal/xml.ts
4
4
  /**
5
5
  * XML text helpers for the writer.
@@ -50,8 +50,9 @@ function xmlAttr(s) {
50
50
  return s.replace(INVALID_XML_CHAR, "").replace(MARKUP_ATTR, entity);
51
51
  }
52
52
  /** True when text needs `xml:space="preserve"` to keep its whitespace. */
53
+ const WS = /\s/;
53
54
  function needsPreserve(s) {
54
- return s.length > 0 && (/^\s/.test(s) || /\s$/.test(s) || s.includes("\n") || s.includes(" "));
55
+ return s.length > 0 && (WS.test(s[0]) || WS.test(s[s.length - 1]) || s.includes("\n") || s.includes(" "));
55
56
  }
56
57
  const XML_DECL = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
57
58
  /**
@@ -61,79 +62,6 @@ const XML_DECL = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
61
62
  function num(n) {
62
63
  return Object.is(n, -0) ? "0" : String(n);
63
64
  }
64
- // src/address.ts
65
- /**
66
- * A1 address helpers (docs/api.md §4.1). Indices are zero-based.
67
- */
68
- /** Rows per sheet in the xlsx format. */
69
- const MAX_ROWS = 1048576;
70
- /** Columns per sheet in the xlsx format (A..XFD). */
71
- const MAX_COLS = 16384;
72
- function invalidRef(ref, why) {
73
- return new require_errors.ValidationError("INVALID_REF", `Invalid reference ${JSON.stringify(ref)}: ${why}.`, { details: { ref } });
74
- }
75
- function checkIndex(n, max, what) {
76
- if (!Number.isInteger(n) || n < 0 || n >= max) throw new require_errors.ValidationError("OUT_OF_BOUNDS", `${what} index ${n} is outside 0..${max - 1}.`, { details: {
77
- index: n,
78
- max: max - 1
79
- } });
80
- }
81
- /** Column index to letters: 0 → 'A', 16383 → 'XFD'. */
82
- function encodeCol(col) {
83
- checkIndex(col, MAX_COLS, "Column");
84
- let s = "";
85
- for (let n = col + 1; n > 0; n = Math.floor((n - 1) / 26)) s = String.fromCharCode(65 + (n - 1) % 26) + s;
86
- return s;
87
- }
88
- /** Column letters to index: 'A' → 0, 'XFD' → 16383. Case-insensitive. */
89
- function decodeCol(letters) {
90
- if (typeof letters !== "string" || !/^[A-Za-z]{1,3}$/.test(letters)) throw invalidRef(letters, "expected column letters");
91
- let n = 0;
92
- for (const ch of letters.toUpperCase()) n = n * 26 + (ch.charCodeAt(0) - 64);
93
- if (n > 16384) throw invalidRef(letters, "beyond column XFD");
94
- return n - 1;
95
- }
96
- /** { row: 0, col: 1 } → 'B1'. */
97
- function encodeCell(a) {
98
- checkIndex(a.row, MAX_ROWS, "Row");
99
- return encodeCol(a.col) + String(a.row + 1);
100
- }
101
- const CELL_RE = /^\$?([A-Za-z]{1,3})\$?([1-9][0-9]{0,6})$/;
102
- /** 'B1' or '$B$1' → { row: 0, col: 1 }. */
103
- function decodeCell(ref) {
104
- const m = typeof ref === "string" ? CELL_RE.exec(ref) : null;
105
- if (!m) throw invalidRef(ref, "expected an A1 cell reference");
106
- const row = Number(m[2]) - 1;
107
- if (row >= 1048576) throw invalidRef(ref, "beyond row 1048576");
108
- return {
109
- row,
110
- col: decodeCol(m[1])
111
- };
112
- }
113
- /** Range to 'A1:C3' (a single cell gives 'A1'). */
114
- function encodeRange(r) {
115
- const a = encodeCell(r.start);
116
- const b = encodeCell(r.end);
117
- return a === b ? a : `${a}:${b}`;
118
- }
119
- /** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
120
- function decodeRange(ref) {
121
- if (typeof ref !== "string") throw invalidRef(ref, "expected an A1 range");
122
- const parts = ref.split(":");
123
- if (parts.length > 2) throw invalidRef(ref, "expected an A1 range");
124
- const a = decodeCell(parts[0]);
125
- const b = parts.length === 2 ? decodeCell(parts[1]) : a;
126
- return {
127
- start: {
128
- row: Math.min(a.row, b.row),
129
- col: Math.min(a.col, b.col)
130
- },
131
- end: {
132
- row: Math.max(a.row, b.row),
133
- col: Math.max(a.col, b.col)
134
- }
135
- };
136
- }
137
65
  // src/styles.ts
138
66
  /** Copies `b`'s defined fields over a copy of `a`. */
139
67
  function mergeFields(a, b) {
@@ -180,32 +108,6 @@ function mergeStyles(...styles) {
180
108
  }
181
109
  return out;
182
110
  }
183
- // src/cells.ts
184
- /**
185
- * Cell helpers (docs/api.md §4.2).
186
- */
187
- function valueText(v, zone) {
188
- if (v === null || v === void 0) return "";
189
- if (typeof v === "string") return v;
190
- if (typeof v === "number") return String(v);
191
- if (typeof v === "boolean") return v ? "TRUE" : "FALSE";
192
- if (v instanceof Date) return Number.isFinite(v.getTime()) ? require_iso_date.isoDate(v, zone) : "";
193
- if (typeof v === "object" && "error" in v) return String(v.error);
194
- if (typeof v === "object" && "richText" in v && Array.isArray(v.richText)) return v.richText.map((r) => r.text).join("");
195
- return "";
196
- }
197
- /**
198
- * Plain text of a cell: strings as they are, numbers as `String(n)`, booleans
199
- * as TRUE/FALSE, dates as ISO 8601, errors as their code, rich text joined.
200
- * A formula cell gives its cached value's text ('' when there is none).
201
- * Number formats are not applied.
202
- */
203
- function cellText(cell, options) {
204
- const zone = options?.dateZone ?? "local";
205
- if (cell === null || cell === void 0) return "";
206
- if (typeof cell !== "object" || cell instanceof Date || "error" in cell || "richText" in cell) return valueText(cell, zone);
207
- return valueText(cell.value, zone);
208
- }
209
111
  // src/internal/write/package.ts
210
112
  /**
211
113
  * The OPC package: which parts exist, their content types and the
@@ -341,26 +243,26 @@ function checkBool(sheet, path, v) {
341
243
  }
342
244
  function checkRange(sheet, path, v) {
343
245
  try {
344
- return decodeRange(v);
246
+ return require_address.decodeRange(v);
345
247
  } catch {
346
248
  throw sheetError(sheet, path, v, "must be an A1 range such as 'A1:C3'", "INVALID_REF");
347
249
  }
348
250
  }
349
251
  function checkCellRef(sheet, path, v) {
350
252
  try {
351
- return encodeCell(decodeCell(v));
253
+ return require_address.encodeCell(require_address.decodeCell(v));
352
254
  } catch {
353
255
  throw sheetError(sheet, path, v, "must be an A1 cell reference", "INVALID_REF");
354
256
  }
355
257
  }
356
258
  const absRange = (r) => {
357
- const a = `$${encodeCol(r.start.col)}$${r.start.row + 1}`;
358
- const b = `$${encodeCol(r.end.col)}$${r.end.row + 1}`;
259
+ const a = `$${require_address.encodeCol(r.start.col)}$${r.start.row + 1}`;
260
+ const b = `$${require_address.encodeCol(r.end.col)}$${r.end.row + 1}`;
359
261
  return a === b ? a : `${a}:${b}`;
360
262
  };
361
263
  const plainRange = (r) => {
362
- const a = encodeCell(r.start);
363
- const b = encodeCell(r.end);
264
+ const a = require_address.encodeCell(r.start);
265
+ const b = require_address.encodeCell(r.end);
364
266
  return a === b ? a : `${a}:${b}`;
365
267
  };
366
268
  /** A sheet name as it appears in a formula reference: always quoted, quotes doubled. */
@@ -397,7 +299,7 @@ var SheetFeatures = class {
397
299
  const colProps = sheet.colProps;
398
300
  if (colProps !== void 0) {
399
301
  if (!Array.isArray(colProps)) throw sheetError(name, "colProps", colProps, "must be an array");
400
- if (colProps.length > 16384) throw sheetError(name, "colProps", colProps.length, `has more than ${MAX_COLS} entries`, "OUT_OF_BOUNDS");
302
+ if (colProps.length > 16384) throw sheetError(name, "colProps", colProps.length, `has more than ${require_address.MAX_COLS} entries`, "OUT_OF_BOUNDS");
401
303
  for (let c = 0; c < colProps.length; c++) {
402
304
  const p = colProps[c];
403
305
  if (p === void 0 || p === null) continue;
@@ -410,7 +312,7 @@ var SheetFeatures = class {
410
312
  this.maxOutlineCol = Math.max(this.maxOutlineCol, outlineLevel);
411
313
  const style = p.style ? styles.xfFor([sheet.defaultStyle, p.style], false, {
412
314
  sheet: name,
413
- ref: `${encodeCol(c)}:${encodeCol(c)}`
315
+ ref: `${require_address.encodeCol(c)}:${require_address.encodeCol(c)}`
414
316
  }) : this.defaultColStyle;
415
317
  this.cols.push({
416
318
  col: c,
@@ -431,7 +333,7 @@ var SheetFeatures = class {
431
333
  const p = rowProps[r];
432
334
  if (p === void 0 || p === null) continue;
433
335
  const path = `rowProps[${r}]`;
434
- if (r >= 1048576) throw sheetError(name, path, r, `is beyond row ${MAX_ROWS}`, "OUT_OF_BOUNDS");
336
+ if (r >= 1048576) throw sheetError(name, path, r, `is beyond row ${require_address.MAX_ROWS}`, "OUT_OF_BOUNDS");
435
337
  if (typeof p !== "object") throw sheetError(name, path, p, "must be an object");
436
338
  let attrs = "";
437
339
  if (p.style) attrs += ` s="${styles.xfFor([sheet.defaultStyle, p.style], false, {
@@ -533,7 +435,7 @@ var SheetFeatures = class {
533
435
  const cols = checkNumber(name, "view.freeze.cols", view.freeze?.cols, 0, 16383, true) ?? 0;
534
436
  if (view.freeze !== void 0 && (typeof view.freeze !== "object" || view.freeze === null)) throw sheetError(name, "view.freeze", view.freeze, "must be { rows?, cols? }");
535
437
  if (rows > 0 || cols > 0) {
536
- const topLeft = encodeCell({
438
+ const topLeft = require_address.encodeCell({
537
439
  row: rows,
538
440
  col: cols
539
441
  });
@@ -626,8 +528,8 @@ var SheetFeatures = class {
626
528
  if (t.cols !== void 0) {
627
529
  const m2 = typeof t.cols === "string" ? /^\$?([A-Za-z]{1,3}):\$?([A-Za-z]{1,3})$/.exec(t.cols) : null;
628
530
  if (!m2) throw sheetError(name, "print.printTitles.cols", t.cols, "must be a column range such as 'A:B'", "INVALID_REF");
629
- const [a, b] = [decodeCol(m2[1]), decodeCol(m2[2])].sort((x, y) => x - y);
630
- refs.push(`${quoteSheet(name)}!$${encodeCol(a)}:$${encodeCol(b)}`);
531
+ const [a, b] = [require_address.decodeCol(m2[1]), require_address.decodeCol(m2[2])].sort((x, y) => x - y);
532
+ refs.push(`${quoteSheet(name)}!$${require_address.encodeCol(a)}:$${require_address.encodeCol(b)}`);
631
533
  }
632
534
  if (t.rows !== void 0) {
633
535
  const m2 = typeof t.rows === "string" ? /^\$?([1-9]\d{0,6}):\$?([1-9]\d{0,6})$/.exec(t.rows) : null;
@@ -706,7 +608,7 @@ var SheetFeatures = class {
706
608
  });
707
609
  next = col + 1;
708
610
  }
709
- fillDefault(MAX_COLS);
611
+ fillDefault(require_address.MAX_COLS);
710
612
  if (specs.length === 0) return "";
711
613
  const merged = [];
712
614
  for (const s of specs) {
@@ -846,18 +748,6 @@ Object.defineProperty(exports, "DEFAULT_HYPERLINK_SCHEMES", {
846
748
  return DEFAULT_HYPERLINK_SCHEMES;
847
749
  }
848
750
  });
849
- Object.defineProperty(exports, "MAX_COLS", {
850
- enumerable: true,
851
- get: function() {
852
- return MAX_COLS;
853
- }
854
- });
855
- Object.defineProperty(exports, "MAX_ROWS", {
856
- enumerable: true,
857
- get: function() {
858
- return MAX_ROWS;
859
- }
860
- });
861
751
  Object.defineProperty(exports, "PackageParts", {
862
752
  enumerable: true,
863
753
  get: function() {
@@ -894,48 +784,6 @@ Object.defineProperty(exports, "XML_DECL", {
894
784
  return XML_DECL;
895
785
  }
896
786
  });
897
- Object.defineProperty(exports, "cellText", {
898
- enumerable: true,
899
- get: function() {
900
- return cellText;
901
- }
902
- });
903
- Object.defineProperty(exports, "decodeCell", {
904
- enumerable: true,
905
- get: function() {
906
- return decodeCell;
907
- }
908
- });
909
- Object.defineProperty(exports, "decodeCol", {
910
- enumerable: true,
911
- get: function() {
912
- return decodeCol;
913
- }
914
- });
915
- Object.defineProperty(exports, "decodeRange", {
916
- enumerable: true,
917
- get: function() {
918
- return decodeRange;
919
- }
920
- });
921
- Object.defineProperty(exports, "encodeCell", {
922
- enumerable: true,
923
- get: function() {
924
- return encodeCell;
925
- }
926
- });
927
- Object.defineProperty(exports, "encodeCol", {
928
- enumerable: true,
929
- get: function() {
930
- return encodeCol;
931
- }
932
- });
933
- Object.defineProperty(exports, "encodeRange", {
934
- enumerable: true,
935
- get: function() {
936
- return encodeRange;
937
- }
938
- });
939
787
  Object.defineProperty(exports, "hyperlinkOf", {
940
788
  enumerable: true,
941
789
  get: function() {
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Binary input and Blob types shared by the reader and the CSV entry.
3
+ *
4
+ * The package compiles without DOM types, so `Blob` cannot be named directly
5
+ * in a published signature. `BlobType` resolves to the platform's own `Blob`
6
+ * whenever the consumer's TypeScript setup declares one (lib "dom", or
7
+ * @types/node), and to the structural `BlobLike` otherwise.
8
+ */
9
+ /** The members of `Blob` the library uses. */
10
+ interface BlobLike {
11
+ readonly size: number;
12
+ readonly type: string;
13
+ arrayBuffer(): Promise<ArrayBuffer>;
14
+ }
15
+ /** The platform `Blob` type when the consumer has one, else `BlobLike`. */
16
+ type BlobType = typeof globalThis extends {
17
+ Blob: {
18
+ prototype: infer B;
19
+ };
20
+ } ? B : BlobLike;
21
+ /** Bytes the library can read. A Node `Buffer` is a `Uint8Array`. */
22
+ type BinaryInput = Uint8Array | ArrayBuffer | BlobType;
23
+ /**
24
+ * Warnings (docs/api.md §7.3).
25
+ *
26
+ * The reader and the CSV parser collect warnings for damage they can recover
27
+ * from, instead of throwing. Each warning is plain data.
28
+ */
29
+ /** Every warning code the library reports. */
30
+ type ExcelWarningCode = "UNSUPPORTED_PART" | "INVALID_STYLE_INDEX" | "INVALID_SHARED_STRING" | "CELL_OUT_OF_BOUNDS" | "INVALID_CELL_REF" | "DUPLICATE_CELL" | "INVALID_DATE_SERIAL" | "SHARED_FORMULA_UNRESOLVED" | "MISSING_PART" | "BROKEN_OPTIONAL_PART" | "HYPERLINK_RANGE_REDUCED" | "SPLIT_PANE_IGNORED" | "ROWS_TRUNCATED" | "COERCION_FAILED" | "NON_FINITE_NUMBER" | "HYPERLINK_DROPPED" | "CSV_UNTERMINATED_QUOTE" | "CSV_STRAY_QUOTE" | "CSV_FIELD_COUNT" | "CSV_INVALID_ENCODING" | "CSV_ROWS_TRUNCATED" | "WARNINGS_TRUNCATED";
31
+ /** A recoverable problem found while reading or building. */
32
+ interface ExcelWarning {
33
+ code: ExcelWarningCode;
34
+ message: string;
35
+ /** Zip part, e.g. `'xl/worksheets/sheet2.xml'`. */
36
+ part?: string | undefined;
37
+ sheet?: string | undefined;
38
+ /** Cell or range, e.g. `'B3'`. For CSV, the cell the record and field map to. */
39
+ ref?: string | undefined;
40
+ }
41
+ export { BlobType as a, BlobLike as i, ExcelWarningCode as n, BinaryInput as r, ExcelWarning as t };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Binary input and Blob types shared by the reader and the CSV entry.
3
+ *
4
+ * The package compiles without DOM types, so `Blob` cannot be named directly
5
+ * in a published signature. `BlobType` resolves to the platform's own `Blob`
6
+ * whenever the consumer's TypeScript setup declares one (lib "dom", or
7
+ * @types/node), and to the structural `BlobLike` otherwise.
8
+ */
9
+ /** The members of `Blob` the library uses. */
10
+ interface BlobLike {
11
+ readonly size: number;
12
+ readonly type: string;
13
+ arrayBuffer(): Promise<ArrayBuffer>;
14
+ }
15
+ /** The platform `Blob` type when the consumer has one, else `BlobLike`. */
16
+ type BlobType = typeof globalThis extends {
17
+ Blob: {
18
+ prototype: infer B;
19
+ };
20
+ } ? B : BlobLike;
21
+ /** Bytes the library can read. A Node `Buffer` is a `Uint8Array`. */
22
+ type BinaryInput = Uint8Array | ArrayBuffer | BlobType;
23
+ /**
24
+ * Warnings (docs/api.md §7.3).
25
+ *
26
+ * The reader and the CSV parser collect warnings for damage they can recover
27
+ * from, instead of throwing. Each warning is plain data.
28
+ */
29
+ /** Every warning code the library reports. */
30
+ type ExcelWarningCode = "UNSUPPORTED_PART" | "INVALID_STYLE_INDEX" | "INVALID_SHARED_STRING" | "CELL_OUT_OF_BOUNDS" | "INVALID_CELL_REF" | "DUPLICATE_CELL" | "INVALID_DATE_SERIAL" | "SHARED_FORMULA_UNRESOLVED" | "MISSING_PART" | "BROKEN_OPTIONAL_PART" | "HYPERLINK_RANGE_REDUCED" | "SPLIT_PANE_IGNORED" | "ROWS_TRUNCATED" | "COERCION_FAILED" | "NON_FINITE_NUMBER" | "HYPERLINK_DROPPED" | "CSV_UNTERMINATED_QUOTE" | "CSV_STRAY_QUOTE" | "CSV_FIELD_COUNT" | "CSV_INVALID_ENCODING" | "CSV_ROWS_TRUNCATED" | "WARNINGS_TRUNCATED";
31
+ /** A recoverable problem found while reading or building. */
32
+ interface ExcelWarning {
33
+ code: ExcelWarningCode;
34
+ message: string;
35
+ /** Zip part, e.g. `'xl/worksheets/sheet2.xml'`. */
36
+ part?: string | undefined;
37
+ sheet?: string | undefined;
38
+ /** Cell or range, e.g. `'B3'`. For CSV, the cell the record and field map to. */
39
+ ref?: string | undefined;
40
+ }
41
+ export { BlobType as a, BlobLike as i, ExcelWarningCode as n, BinaryInput as r, ExcelWarning as t };