javascript-excel 2.0.0-alpha.2 → 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 (65) hide show
  1. package/README.md +151 -21
  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.d.cts +4 -1
  10. package/dist/csv.d.ts +4 -1
  11. package/dist/dataset-KeMzHCGl.js +664 -0
  12. package/dist/dataset-UUZCzsi3.cjs +687 -0
  13. package/dist/dates-BXcSWf9_.js +64 -0
  14. package/dist/dates-CA1dCizp.cjs +75 -0
  15. package/dist/dom.cjs +5 -2
  16. package/dist/dom.d.cts +5 -2
  17. package/dist/dom.d.ts +4 -1
  18. package/dist/dom.js +4 -1
  19. package/dist/{numfmt-Dv6AjopS.cjs → dos-time-FZ7-1tot.cjs} +0 -199
  20. package/dist/{numfmt-BBgB7iQA.js → dos-time-dD0z1YWU.js} +2 -177
  21. package/dist/format.cjs +1264 -0
  22. package/dist/format.d.cts +59 -0
  23. package/dist/format.d.ts +59 -0
  24. package/dist/format.js +1262 -0
  25. package/dist/import.cjs +10 -0
  26. package/dist/import.d.cts +10 -0
  27. package/dist/import.d.ts +10 -0
  28. package/dist/import.js +1 -0
  29. package/dist/index.cjs +24 -607
  30. package/dist/index.d.cts +32 -6
  31. package/dist/index.d.ts +31 -5
  32. package/dist/index.js +10 -594
  33. package/dist/{warnings-C_12PT4t.d.cts → model-0JikLfuM.d.cts} +1 -41
  34. package/dist/{warnings-DXJKe1lx.d.ts → model-0JikLfuM.d.ts} +1 -41
  35. package/dist/numfmt-BmEbm78Y.cjs +125 -0
  36. package/dist/numfmt-DCDrX9P1.js +114 -0
  37. package/dist/pipeline-BAJtzBdW.js +1085 -0
  38. package/dist/pipeline-Bnf7EU3X.cjs +1132 -0
  39. package/dist/pipeline-CctEa86r.d.cts +186 -0
  40. package/dist/pipeline-I8SLmV9S.d.ts +186 -0
  41. package/dist/{read-Ym1voUct.cjs → read-CZEWV4rK.cjs} +181 -17
  42. package/dist/{read-DDN5ZsPe.js → read-LWti17lz.js} +169 -5
  43. package/dist/read.cjs +1 -1
  44. package/dist/read.d.cts +78 -4
  45. package/dist/read.d.ts +78 -4
  46. package/dist/read.js +1 -1
  47. package/dist/render.cjs +751 -0
  48. package/dist/render.d.cts +215 -0
  49. package/dist/render.d.ts +215 -0
  50. package/dist/render.js +732 -0
  51. package/dist/{sheet-names-uT2EH5Ui.js → sheet-names-7p-joVsG.js} +2 -101
  52. package/dist/{sheet-names-qpXsvMpM.cjs → sheet-names-B8U5RAW0.cjs} +14 -167
  53. package/dist/warnings-B1v58nCZ.d.cts +41 -0
  54. package/dist/warnings-B1v58nCZ.d.ts +41 -0
  55. package/dist/worker.cjs +10 -2
  56. package/dist/worker.d.cts +10 -4
  57. package/dist/worker.d.ts +10 -4
  58. package/dist/worker.js +10 -2
  59. package/dist/{write-CYpLGuzl.d.ts → write-DM6ieuQY.d.ts} +2 -1
  60. package/dist/{write-DubvcG-x.js → write-DjgWy1PK.js} +5 -2
  61. package/dist/{write-C5JgeIar.d.cts → write-DtjfdIFm.d.cts} +2 -1
  62. package/dist/{write-BOh9jfu1.cjs → write-f9kcYf5K.cjs} +31 -28
  63. package/package.json +32 -1
  64. package/dist/read-C6L7Nyy3.d.cts +0 -78
  65. package/dist/read-Ddkks7qC.d.ts +0 -78
package/dist/index.d.cts CHANGED
@@ -4,11 +4,14 @@
4
4
  * This entry exports the workbook model types (docs/api.md §3), the error
5
5
  * classes (§7), the xlsx writer (§5.1) and the address, date and style
6
6
  * helpers (§4). Builders land in later pull requests.
7
+ *
8
+ * @module javascript-excel
7
9
  */
8
- import { A as RichTextRun, C as GradientFill, D as PatternType, E as PatternFill, F as Theme, I as Workbook, M as Sheet, N as SheetView, O as PrintSetup, P as Style, S as Font, T as NumFmt, _ as ColumnWidth, a as BlobType, b as ErrorCode, c as BorderSide, d as CellErrorValue, f as CellInput, g as ColumnProps, h as Color, i as BlobLike, j as RowProps, k as RichText, l as BorderStyle, m as CellValue, n as ExcelWarningCode, o as Alignment, p as CellType, r as BinaryInput, s as Border, t as ExcelWarning, u as Cell, v as DefinedName, w as Hyperlink, x as Fill, y as DocProperties } from "./warnings-C_12PT4t.cjs";
9
- import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-C5JgeIar.cjs";
10
+ import { A as Theme, C as PrintSetup, D as Sheet, E as RowProps, O as SheetView, S as PatternType, T as RichTextRun, _ as Font, a as Cell, b as NumFmt, c as CellType, d as ColumnProps, f as ColumnWidth, g as Fill, h as ErrorCode, i as BorderStyle, j as Workbook, k as Style, l as CellValue, m as DocProperties, n as Border, o as CellErrorValue, p as DefinedName, r as BorderSide, s as CellInput, t as Alignment, u as Color, v as GradientFill, w as RichText, x as PatternFill, y as Hyperlink } from "./model-0JikLfuM.cjs";
11
+ import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-DtjfdIFm.cjs";
12
+ import { a as BlobType, i as BlobLike, n as ExcelWarningCode, r as BinaryInput, t as ExcelWarning } from "./warnings-B1v58nCZ.cjs";
10
13
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
11
- import { t as AutoWidthOptions } from "./auto-width-2oBzjeNG.cjs";
14
+ import { t as AutoWidthOptions } from "./auto-width-DRHsPKNk.cjs";
12
15
  /**
13
16
  * Typed errors (docs/api.md §7).
14
17
  *
@@ -16,7 +19,7 @@ import { t as AutoWidthOptions } from "./auto-width-2oBzjeNG.cjs";
16
19
  * app ends up with both the ESM and the CJS build, each has its own classes.
17
20
  */
18
21
  /** Every error code the library throws. */
19
- type ExcelErrorCode = "NO_SHEETS" | "INVALID_SHEET_NAME" | "DUPLICATE_SHEET_NAME" | "INVALID_ACTIVE_SHEET" | "INVALID_REF" | "OUT_OF_BOUNDS" | "INVALID_CELL" | "INVALID_NUMBER" | "INVALID_DATE" | "STRING_TOO_LONG" | "INVALID_STYLE" | "INVALID_NUMFMT" | "INVALID_HYPERLINK" | "OVERLAPPING_MERGE" | "INVALID_COLUMN" | "TOO_MANY_STYLES" | "ZIP64_REQUIRED" | "INVALID_PROPERTY" | "INVALID_SHEET_PROPERTY" | "INVALID_DEFINED_NAME" | "UNSUPPORTED_FORMAT" | "NOT_XLSX" | "ZIP_INVALID" | "ZIP_UNSUPPORTED_METHOD" | "ZIP_ENCRYPTED" | "ZIP_CRC_MISMATCH" | "XML_MALFORMED" | "XML_DTD_FORBIDDEN" | "LIMIT_EXCEEDED" | "CSV_MALFORMED" | "ENVIRONMENT_UNSUPPORTED";
22
+ type ExcelErrorCode = "NO_SHEETS" | "INVALID_SHEET_NAME" | "DUPLICATE_SHEET_NAME" | "INVALID_ACTIVE_SHEET" | "INVALID_REF" | "OUT_OF_BOUNDS" | "INVALID_CELL" | "INVALID_NUMBER" | "INVALID_DATE" | "STRING_TOO_LONG" | "INVALID_STYLE" | "INVALID_NUMFMT" | "INVALID_HYPERLINK" | "OVERLAPPING_MERGE" | "INVALID_COLUMN" | "TOO_MANY_STYLES" | "ZIP64_REQUIRED" | "INVALID_PROPERTY" | "INVALID_SHEET_PROPERTY" | "INVALID_DEFINED_NAME" | "SHEET_NOT_FOUND" | "VALIDATION_FAILED" | "UNSUPPORTED_FORMAT" | "NOT_XLSX" | "ZIP_INVALID" | "ZIP_UNSUPPORTED_METHOD" | "ZIP_ENCRYPTED" | "ZIP_CRC_MISMATCH" | "XML_MALFORMED" | "XML_DTD_FORBIDDEN" | "LIMIT_EXCEEDED" | "CSV_MALFORMED" | "ENVIRONMENT_UNSUPPORTED";
20
23
  /** Options accepted by every error constructor. */
21
24
  interface ExcelErrorOptions {
22
25
  cause?: unknown;
@@ -71,6 +74,18 @@ export declare function serialToDate(serial: number, options?: DateOptions): Dat
71
74
  * The inputs are not modified.
72
75
  */
73
76
  export declare function mergeStyles(...styles: Array<Style | undefined>): Style;
77
+ /** Context for `resolveColor`: the workbook's `theme` and `indexedColors`. */
78
+ interface ColorContext {
79
+ theme?: Theme | undefined;
80
+ indexedColors?: readonly string[] | undefined;
81
+ }
82
+ /**
83
+ * Resolves any `Color` to ARGB ('FFRRGGBB'). Theme colours use the file's
84
+ * theme and apply the tint (ECMA-376 §18.8.19, on HSL luminance); indexed
85
+ * colours use the file's palette. Without them, the defaults are used.
86
+ * Automatic colour and anything unreadable give black.
87
+ */
88
+ export declare function resolveColor(color: Color, ctx?: ColorContext): string;
74
89
  /** Options for `cellText`. */
75
90
  interface CellTextOptions {
76
91
  /** Fields used for dates. Default 'local'. */
@@ -181,6 +196,17 @@ interface ToDatasetOptions {
181
196
  range?: string | undefined;
182
197
  /** 'value' (default): each field is the cell's value; 'cell': the whole Cell. */
183
198
  values?: "value" | "cell" | undefined;
199
+ /**
200
+ * Drop a totals row at the end. 'auto' (default): drop the last row when it
201
+ * has at least one formula and all its formulas are SUBTOTAL(...), as
202
+ * fromDataset writes them (a label such as "Total" may sit next to them).
203
+ * true: always drop the last row. false: keep it.
204
+ */
205
+ skipTotals?: "auto" | boolean | undefined;
206
+ /** Header rows from `headerRow` on, flattened into one title per column (merged cells expanded). Default 1. */
207
+ headerRows?: number | undefined;
208
+ /** Joins the parts of a multi-row title. Default ' / '. */
209
+ join?: string | undefined;
184
210
  }
185
211
  /** The result of `toDataset`. Rows are null-prototype objects. */
186
212
  interface DatasetResult {
@@ -251,5 +277,5 @@ export declare function encodeRange(r: RangeAddress): string;
251
277
  /** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
252
278
  export declare function decodeRange(ref: string): RangeAddress;
253
279
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
254
- export declare const VERSION = "2.0.0-alpha.2";
255
- export { type AbortSignalLike, type Alignment, type AutoWidthOptions, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellAddress, type CellErrorValue, type CellInput, type CellTextOptions, type CellType, type CellValue, type Color, type ColumnDef, type ColumnProps, type ColumnTotal, type ColumnWidth, type Dataset, type DatasetBlock, type DatasetOptions, type DatasetResult, type DateOptions, type DefinedName, type DocProperties, type ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type GroupColumn, type Hyperlink, type LeafColumn, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RangeAddress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetNameProblem, type SheetView, type Style, type Theme, type ToDatasetOptions, type Workbook, type WriteOptions, XLSX_MIME, toBlob, toUint8Array };
280
+ export declare const VERSION = "2.0.0-alpha.3";
281
+ export { type AbortSignalLike, type Alignment, type AutoWidthOptions, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellAddress, type CellErrorValue, type CellInput, type CellTextOptions, type CellType, type CellValue, type Color, type ColorContext, type ColumnDef, type ColumnProps, type ColumnTotal, type ColumnWidth, type Dataset, type DatasetBlock, type DatasetOptions, type DatasetResult, type DateOptions, type DefinedName, type DocProperties, type ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type GroupColumn, type Hyperlink, type LeafColumn, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RangeAddress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetNameProblem, type SheetView, type Style, type Theme, type ToDatasetOptions, type Workbook, type WriteOptions, XLSX_MIME, toBlob, toUint8Array };
package/dist/index.d.ts CHANGED
@@ -4,9 +4,12 @@
4
4
  * This entry exports the workbook model types (docs/api.md §3), the error
5
5
  * classes (§7), the xlsx writer (§5.1) and the address, date and style
6
6
  * helpers (§4). Builders land in later pull requests.
7
+ *
8
+ * @module javascript-excel
7
9
  */
8
- import { A as SheetView, C as PatternFill, D as RichTextRun, E as RichText, F as BlobLike, I as BlobType, M as Theme, N as Workbook, O as RowProps, P as BinaryInput, S as NumFmt, T as PrintSetup, _ as ErrorCode, a as BorderSide, b as GradientFill, c as CellErrorValue, d as CellValue, f as Color, g as DocProperties, h as DefinedName, i as Border, j as Style, k as Sheet, l as CellInput, m as ColumnWidth, n as ExcelWarningCode, o as BorderStyle, p as ColumnProps, r as Alignment, s as Cell, t as ExcelWarning, u as CellType, v as Fill, w as PatternType, x as Hyperlink, y as Font } from "./warnings-DXJKe1lx.js";
9
- import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-CYpLGuzl.js";
10
+ import { A as Theme, C as PrintSetup, D as Sheet, E as RowProps, O as SheetView, S as PatternType, T as RichTextRun, _ as Font, a as Cell, b as NumFmt, c as CellType, d as ColumnProps, f as ColumnWidth, g as Fill, h as ErrorCode, i as BorderStyle, j as Workbook, k as Style, l as CellValue, m as DocProperties, n as Border, o as CellErrorValue, p as DefinedName, r as BorderSide, s as CellInput, t as Alignment, u as Color, v as GradientFill, w as RichText, x as PatternFill, y as Hyperlink } from "./model-0JikLfuM.js";
11
+ import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-DM6ieuQY.js";
12
+ import { a as BlobType, i as BlobLike, n as ExcelWarningCode, r as BinaryInput, t as ExcelWarning } from "./warnings-B1v58nCZ.js";
10
13
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
11
14
  import { t as AutoWidthOptions } from "./auto-width-CT-BihTW.js";
12
15
  /**
@@ -16,7 +19,7 @@ import { t as AutoWidthOptions } from "./auto-width-CT-BihTW.js";
16
19
  * app ends up with both the ESM and the CJS build, each has its own classes.
17
20
  */
18
21
  /** Every error code the library throws. */
19
- type ExcelErrorCode = "NO_SHEETS" | "INVALID_SHEET_NAME" | "DUPLICATE_SHEET_NAME" | "INVALID_ACTIVE_SHEET" | "INVALID_REF" | "OUT_OF_BOUNDS" | "INVALID_CELL" | "INVALID_NUMBER" | "INVALID_DATE" | "STRING_TOO_LONG" | "INVALID_STYLE" | "INVALID_NUMFMT" | "INVALID_HYPERLINK" | "OVERLAPPING_MERGE" | "INVALID_COLUMN" | "TOO_MANY_STYLES" | "ZIP64_REQUIRED" | "INVALID_PROPERTY" | "INVALID_SHEET_PROPERTY" | "INVALID_DEFINED_NAME" | "UNSUPPORTED_FORMAT" | "NOT_XLSX" | "ZIP_INVALID" | "ZIP_UNSUPPORTED_METHOD" | "ZIP_ENCRYPTED" | "ZIP_CRC_MISMATCH" | "XML_MALFORMED" | "XML_DTD_FORBIDDEN" | "LIMIT_EXCEEDED" | "CSV_MALFORMED" | "ENVIRONMENT_UNSUPPORTED";
22
+ type ExcelErrorCode = "NO_SHEETS" | "INVALID_SHEET_NAME" | "DUPLICATE_SHEET_NAME" | "INVALID_ACTIVE_SHEET" | "INVALID_REF" | "OUT_OF_BOUNDS" | "INVALID_CELL" | "INVALID_NUMBER" | "INVALID_DATE" | "STRING_TOO_LONG" | "INVALID_STYLE" | "INVALID_NUMFMT" | "INVALID_HYPERLINK" | "OVERLAPPING_MERGE" | "INVALID_COLUMN" | "TOO_MANY_STYLES" | "ZIP64_REQUIRED" | "INVALID_PROPERTY" | "INVALID_SHEET_PROPERTY" | "INVALID_DEFINED_NAME" | "SHEET_NOT_FOUND" | "VALIDATION_FAILED" | "UNSUPPORTED_FORMAT" | "NOT_XLSX" | "ZIP_INVALID" | "ZIP_UNSUPPORTED_METHOD" | "ZIP_ENCRYPTED" | "ZIP_CRC_MISMATCH" | "XML_MALFORMED" | "XML_DTD_FORBIDDEN" | "LIMIT_EXCEEDED" | "CSV_MALFORMED" | "ENVIRONMENT_UNSUPPORTED";
20
23
  /** Options accepted by every error constructor. */
21
24
  interface ExcelErrorOptions {
22
25
  cause?: unknown;
@@ -71,6 +74,18 @@ export declare function serialToDate(serial: number, options?: DateOptions): Dat
71
74
  * The inputs are not modified.
72
75
  */
73
76
  export declare function mergeStyles(...styles: Array<Style | undefined>): Style;
77
+ /** Context for `resolveColor`: the workbook's `theme` and `indexedColors`. */
78
+ interface ColorContext {
79
+ theme?: Theme | undefined;
80
+ indexedColors?: readonly string[] | undefined;
81
+ }
82
+ /**
83
+ * Resolves any `Color` to ARGB ('FFRRGGBB'). Theme colours use the file's
84
+ * theme and apply the tint (ECMA-376 §18.8.19, on HSL luminance); indexed
85
+ * colours use the file's palette. Without them, the defaults are used.
86
+ * Automatic colour and anything unreadable give black.
87
+ */
88
+ export declare function resolveColor(color: Color, ctx?: ColorContext): string;
74
89
  /** Options for `cellText`. */
75
90
  interface CellTextOptions {
76
91
  /** Fields used for dates. Default 'local'. */
@@ -181,6 +196,17 @@ interface ToDatasetOptions {
181
196
  range?: string | undefined;
182
197
  /** 'value' (default): each field is the cell's value; 'cell': the whole Cell. */
183
198
  values?: "value" | "cell" | undefined;
199
+ /**
200
+ * Drop a totals row at the end. 'auto' (default): drop the last row when it
201
+ * has at least one formula and all its formulas are SUBTOTAL(...), as
202
+ * fromDataset writes them (a label such as "Total" may sit next to them).
203
+ * true: always drop the last row. false: keep it.
204
+ */
205
+ skipTotals?: "auto" | boolean | undefined;
206
+ /** Header rows from `headerRow` on, flattened into one title per column (merged cells expanded). Default 1. */
207
+ headerRows?: number | undefined;
208
+ /** Joins the parts of a multi-row title. Default ' / '. */
209
+ join?: string | undefined;
184
210
  }
185
211
  /** The result of `toDataset`. Rows are null-prototype objects. */
186
212
  interface DatasetResult {
@@ -251,5 +277,5 @@ export declare function encodeRange(r: RangeAddress): string;
251
277
  /** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
252
278
  export declare function decodeRange(ref: string): RangeAddress;
253
279
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
254
- export declare const VERSION = "2.0.0-alpha.2";
255
- export { type AbortSignalLike, type Alignment, type AutoWidthOptions, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellAddress, type CellErrorValue, type CellInput, type CellTextOptions, type CellType, type CellValue, type Color, type ColumnDef, type ColumnProps, type ColumnTotal, type ColumnWidth, type Dataset, type DatasetBlock, type DatasetOptions, type DatasetResult, type DateOptions, type DefinedName, type DocProperties, type ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type GroupColumn, type Hyperlink, type LeafColumn, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RangeAddress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetNameProblem, type SheetView, type Style, type Theme, type ToDatasetOptions, type Workbook, type WriteOptions, XLSX_MIME, toBlob, toUint8Array };
280
+ export declare const VERSION = "2.0.0-alpha.3";
281
+ export { type AbortSignalLike, type Alignment, type AutoWidthOptions, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellAddress, type CellErrorValue, type CellInput, type CellTextOptions, type CellType, type CellValue, type Color, type ColorContext, type ColumnDef, type ColumnProps, type ColumnTotal, type ColumnWidth, type Dataset, type DatasetBlock, type DatasetOptions, type DatasetResult, type DateOptions, type DefinedName, type DocProperties, type ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type GroupColumn, type Hyperlink, type LeafColumn, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RangeAddress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetNameProblem, type SheetView, type Style, type Theme, type ToDatasetOptions, type Workbook, type WriteOptions, XLSX_MIME, toBlob, toUint8Array };