@office-kit/xlsx 0.11.0 → 0.12.0

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 (182) hide show
  1. package/README.md +11 -1
  2. package/dist/cell/cell.d.ts +45 -10
  3. package/dist/cell/index.d.ts +4 -4
  4. package/dist/cell/rich-text.d.ts +1 -1
  5. package/dist/{cell-BucgGwl3.mjs → cell-Df3cKRIl.mjs} +72 -30
  6. package/dist/cell-Df3cKRIl.mjs.map +1 -0
  7. package/dist/{cell-style-DuvS_Lsg.mjs → cell-style-BFmJOmcx.mjs} +130 -93
  8. package/dist/cell-style-BFmJOmcx.mjs.map +1 -0
  9. package/dist/cell.mjs +2 -2
  10. package/dist/chart/chart-xml.d.ts +1 -1
  11. package/dist/chart/chart.d.ts +3 -3
  12. package/dist/chart/cx/chartex-xml.d.ts +1 -1
  13. package/dist/chart/cx/chartex.d.ts +2 -2
  14. package/dist/chart/index.d.ts +6 -6
  15. package/dist/chart/user-shapes-xml.d.ts +1 -1
  16. package/dist/chart/user-shapes.d.ts +2 -2
  17. package/dist/chart.mjs.map +1 -1
  18. package/dist/chartsheet/chartsheet-xml.d.ts +1 -1
  19. package/dist/chartsheet/chartsheet.d.ts +4 -4
  20. package/dist/chartsheet/index.d.ts +2 -2
  21. package/dist/chartsheet-C3-tqkPy.mjs.map +1 -1
  22. package/dist/{coordinate-96Ecci4d.mjs → coordinate-Bt5Gni2I.mjs} +19 -8
  23. package/dist/coordinate-Bt5Gni2I.mjs.map +1 -0
  24. package/dist/datetime-B2ySVlXt.mjs.map +1 -1
  25. package/dist/{defined-names-CviWmtQg.mjs → defined-names-Ctu3F6ls.mjs} +4 -3
  26. package/dist/defined-names-Ctu3F6ls.mjs.map +1 -0
  27. package/dist/{differential-DvKU8fJt.mjs → differential-H9SjEeIU.mjs} +2 -2
  28. package/dist/differential-H9SjEeIU.mjs.map +1 -0
  29. package/dist/drawing/dml/dml-xml.d.ts +8 -8
  30. package/dist/drawing/dml/effect.d.ts +2 -2
  31. package/dist/drawing/dml/fill.d.ts +1 -1
  32. package/dist/drawing/dml/geometry.d.ts +1 -1
  33. package/dist/drawing/dml/line.d.ts +1 -1
  34. package/dist/drawing/dml/shape-properties.d.ts +5 -5
  35. package/dist/drawing/dml/text.d.ts +4 -4
  36. package/dist/drawing/drawing-xml.d.ts +1 -1
  37. package/dist/drawing/drawing.d.ts +9 -9
  38. package/dist/drawing/index.d.ts +14 -14
  39. package/dist/{drawing-BxzLuryn.mjs → drawing-ZJ3h4VHD.mjs} +2 -2
  40. package/dist/drawing-ZJ3h4VHD.mjs.map +1 -0
  41. package/dist/drawing.mjs +1 -1
  42. package/dist/drawing.mjs.map +1 -1
  43. package/dist/{escape-DFTE7ZJc.mjs → escape-rnWSPpWY.mjs} +4 -6
  44. package/dist/{escape-DFTE7ZJc.mjs.map → escape-rnWSPpWY.mjs.map} +1 -1
  45. package/dist/formula/tokenizer.d.ts +1 -1
  46. package/dist/formula/translate.d.ts +2 -2
  47. package/dist/{inference-BrI9uIY4.mjs → inference-BMvv9cUY.mjs} +18 -3
  48. package/dist/inference-BMvv9cUY.mjs.map +1 -0
  49. package/dist/io/browser.d.ts +2 -2
  50. package/dist/io/index.d.ts +7 -7
  51. package/dist/io/load.d.ts +4 -4
  52. package/dist/io/node-fs.d.ts +2 -2
  53. package/dist/io/node-save.d.ts +2 -2
  54. package/dist/io/node.d.ts +2 -2
  55. package/dist/io/save.d.ts +2 -2
  56. package/dist/io.mjs +2 -2
  57. package/dist/io.mjs.map +1 -1
  58. package/dist/{load-MyOIjtrU.mjs → load-CJdGh50R.mjs} +8 -8
  59. package/dist/load-CJdGh50R.mjs.map +1 -0
  60. package/dist/{manifest-Cm9K7D62.mjs → manifest-pLmx7KYh.mjs} +3 -3
  61. package/dist/manifest-pLmx7KYh.mjs.map +1 -0
  62. package/dist/node.d.ts +3 -3
  63. package/dist/node.mjs +1 -1
  64. package/dist/node.mjs.map +1 -1
  65. package/dist/packaging/core.d.ts +1 -1
  66. package/dist/packaging/custom.d.ts +2 -2
  67. package/dist/packaging/extended.d.ts +2 -2
  68. package/dist/packaging/index.d.ts +10 -10
  69. package/dist/packaging.mjs +1 -1
  70. package/dist/{parser-D3SLaOFe.mjs → parser-By6RWZVW.mjs} +39 -10
  71. package/dist/parser-By6RWZVW.mjs.map +1 -0
  72. package/dist/reader-BNaUTVCy.mjs.map +1 -1
  73. package/dist/{save-2moCT3Af.mjs → save-a0InIbtJ.mjs} +10 -8
  74. package/dist/save-a0InIbtJ.mjs.map +1 -0
  75. package/dist/schema/core.d.ts +1 -1
  76. package/dist/schema/index.d.ts +3 -3
  77. package/dist/schema/serialize.d.ts +2 -2
  78. package/dist/serialize-BC2Wu3bR.mjs.map +1 -1
  79. package/dist/{serializer-BtO2TrI7.mjs → serializer-C6nm0mRJ.mjs} +2 -2
  80. package/dist/serializer-C6nm0mRJ.mjs.map +1 -0
  81. package/dist/streaming/index.d.ts +2 -2
  82. package/dist/streaming/read-only.d.ts +4 -4
  83. package/dist/streaming/write-only.d.ts +9 -15
  84. package/dist/streaming.mjs +19 -49
  85. package/dist/streaming.mjs.map +1 -1
  86. package/dist/styles/alignment.schema.d.ts +2 -2
  87. package/dist/styles/borders.d.ts +1 -1
  88. package/dist/styles/borders.schema.d.ts +2 -2
  89. package/dist/styles/cell-style.d.ts +86 -40
  90. package/dist/styles/colors.schema.d.ts +2 -2
  91. package/dist/styles/differential.d.ts +7 -7
  92. package/dist/styles/fills.d.ts +1 -1
  93. package/dist/styles/fills.schema.d.ts +2 -2
  94. package/dist/styles/fonts.d.ts +11 -2
  95. package/dist/styles/fonts.schema.d.ts +2 -2
  96. package/dist/styles/index.d.ts +21 -21
  97. package/dist/styles/named-styles.d.ts +6 -6
  98. package/dist/styles/numbers.schema.d.ts +2 -2
  99. package/dist/styles/protection.schema.d.ts +2 -2
  100. package/dist/styles/stylesheet-reader.d.ts +1 -1
  101. package/dist/styles/stylesheet-writer.d.ts +1 -1
  102. package/dist/styles/stylesheet.d.ts +34 -8
  103. package/dist/styles.mjs +4 -4
  104. package/dist/{stylesheet-writer-BrOw4jMY.mjs → stylesheet-writer-D7Uug85X.mjs} +35 -22
  105. package/dist/stylesheet-writer-D7Uug85X.mjs.map +1 -0
  106. package/dist/{table-1P8we2gS.mjs → table-Ccro4rrz.mjs} +11 -9
  107. package/dist/table-Ccro4rrz.mjs.map +1 -0
  108. package/dist/tree-BX-sRRVp.mjs.map +1 -1
  109. package/dist/user-shapes-DfmCGKB0.mjs.map +1 -1
  110. package/dist/utf8-Tn3nzyik.mjs.map +1 -1
  111. package/dist/utils/coordinate.d.ts +30 -4
  112. package/dist/utils/escape.d.ts +3 -5
  113. package/dist/utils/formula-text.d.ts +7 -0
  114. package/dist/utils/index.d.ts +11 -11
  115. package/dist/utils.mjs +3 -3
  116. package/dist/workbook/calc-properties.d.ts +9 -2
  117. package/dist/workbook/defined-names.d.ts +3 -3
  118. package/dist/workbook/index.d.ts +24 -24
  119. package/dist/workbook/protection.d.ts +1 -1
  120. package/dist/workbook/shared-strings.d.ts +2 -2
  121. package/dist/workbook/views.d.ts +1 -1
  122. package/dist/workbook/workbook-properties.d.ts +1 -1
  123. package/dist/workbook/workbook.d.ts +46 -46
  124. package/dist/{workbook-CARZS94U.mjs → workbook-B15-T4cs.mjs} +8 -8
  125. package/dist/workbook-B15-T4cs.mjs.map +1 -0
  126. package/dist/workbook.mjs +45 -3
  127. package/dist/workbook.mjs.map +1 -1
  128. package/dist/worksheet/auto-filter.d.ts +1 -1
  129. package/dist/worksheet/cell-range.d.ts +11 -4
  130. package/dist/worksheet/comments-xml.d.ts +1 -1
  131. package/dist/worksheet/conditional-formatting.d.ts +2 -2
  132. package/dist/worksheet/custom-sheet-views.d.ts +2 -2
  133. package/dist/worksheet/data-validations.d.ts +3 -3
  134. package/dist/worksheet/errors.d.ts +1 -1
  135. package/dist/worksheet/hyperlinks.d.ts +1 -1
  136. package/dist/worksheet/index.d.ts +46 -46
  137. package/dist/worksheet/ole-objects.d.ts +1 -1
  138. package/dist/worksheet/page-setup.d.ts +1 -1
  139. package/dist/worksheet/properties.d.ts +1 -1
  140. package/dist/worksheet/protected-ranges.d.ts +1 -1
  141. package/dist/worksheet/protection.d.ts +1 -1
  142. package/dist/worksheet/reader.d.ts +9 -9
  143. package/dist/worksheet/scenarios.d.ts +1 -1
  144. package/dist/worksheet/table-validate.d.ts +7 -0
  145. package/dist/worksheet/table-xml.d.ts +1 -1
  146. package/dist/worksheet/table.d.ts +6 -3
  147. package/dist/worksheet/views.d.ts +5 -0
  148. package/dist/worksheet/worksheet.d.ts +135 -94
  149. package/dist/worksheet/writer.d.ts +16 -9
  150. package/dist/{worksheet-C5Ensf_j.mjs → worksheet-4xW-i8j9.mjs} +235 -51
  151. package/dist/worksheet-4xW-i8j9.mjs.map +1 -0
  152. package/dist/worksheet.mjs +3 -3
  153. package/dist/worksheet.mjs.map +1 -1
  154. package/dist/writer-IyFccCRJ.mjs.map +1 -1
  155. package/dist/xml/index.d.ts +10 -10
  156. package/dist/xml/parser.d.ts +1 -1
  157. package/dist/xml/serializer.d.ts +1 -1
  158. package/dist/xml/stream-writer.d.ts +1 -1
  159. package/dist/xml.mjs +3 -3
  160. package/dist/xml.mjs.map +1 -1
  161. package/dist/zip/decompression-guard.d.ts +1 -1
  162. package/dist/zip/index.d.ts +6 -6
  163. package/dist/zip/random-access-reader.d.ts +2 -2
  164. package/dist/zip/reader.d.ts +2 -2
  165. package/dist/zip/writer.d.ts +1 -1
  166. package/package.json +4 -1
  167. package/dist/cell-BucgGwl3.mjs.map +0 -1
  168. package/dist/cell-style-DuvS_Lsg.mjs.map +0 -1
  169. package/dist/coordinate-96Ecci4d.mjs.map +0 -1
  170. package/dist/defined-names-CviWmtQg.mjs.map +0 -1
  171. package/dist/differential-DvKU8fJt.mjs.map +0 -1
  172. package/dist/drawing-BxzLuryn.mjs.map +0 -1
  173. package/dist/inference-BrI9uIY4.mjs.map +0 -1
  174. package/dist/load-MyOIjtrU.mjs.map +0 -1
  175. package/dist/manifest-Cm9K7D62.mjs.map +0 -1
  176. package/dist/parser-D3SLaOFe.mjs.map +0 -1
  177. package/dist/save-2moCT3Af.mjs.map +0 -1
  178. package/dist/serializer-BtO2TrI7.mjs.map +0 -1
  179. package/dist/stylesheet-writer-BrOw4jMY.mjs.map +0 -1
  180. package/dist/table-1P8we2gS.mjs.map +0 -1
  181. package/dist/workbook-CARZS94U.mjs.map +0 -1
  182. package/dist/worksheet-C5Ensf_j.mjs.map +0 -1
@@ -1,3 +1,3 @@
1
- import { type Schema } from '../schema/core';
2
- import type { Protection } from './protection';
1
+ import { type Schema } from '../schema/core.js';
2
+ import type { Protection } from './protection.js';
3
3
  export declare const ProtectionSchema: Schema<Protection>;
@@ -1,4 +1,4 @@
1
- import { type Stylesheet } from './stylesheet';
1
+ import { type Stylesheet } from './stylesheet.js';
2
2
  /**
3
3
  * Parse `xl/styles.xml` and return a fully-populated {@link Stylesheet}. Slot
4
4
  * ordering is preserved verbatim; the dedup index Maps are rebuilt after the
@@ -1,3 +1,3 @@
1
- import type { Stylesheet } from './stylesheet';
1
+ import type { Stylesheet } from './stylesheet.js';
2
2
  /** Serialise a Stylesheet to its `xl/styles.xml` payload. */
3
3
  export declare function stylesheetToBytes(ss: Stylesheet): Uint8Array;
@@ -1,8 +1,8 @@
1
- import type { Alignment } from './alignment';
2
- import type { Border } from './borders';
3
- import type { Fill } from './fills';
4
- import type { Font } from './fonts';
5
- import type { Protection } from './protection';
1
+ import type { Alignment } from './alignment.js';
2
+ import type { Border } from './borders.js';
3
+ import type { Fill } from './fills.js';
4
+ import type { Font } from './fonts.js';
5
+ import type { Protection } from './protection.js';
6
6
  /**
7
7
  * One entry in the cellXfs / cellStyleXfs pool. Represents the union of
8
8
  * indexes-into-other-pools that a cell or named style points at.
@@ -38,7 +38,7 @@ export interface Stylesheet {
38
38
  cellXfs: CellXf[];
39
39
  cellStyleXfs: CellXf[];
40
40
  /** Named styles (Excel's "Cell Styles" gallery; populated by addNamedStyle). */
41
- namedStyles?: Array<import('./named-styles').StylesheetNamedStyle>;
41
+ namedStyles?: Array<import('./named-styles.js').StylesheetNamedStyle>;
42
42
  /**
43
43
  * The tail of `<styleSheet>` this model doesn't cover — `<tableStyles>`,
44
44
  * `<colors>` and `<extLst>` (which is where Excel keeps its x14/x15 slicer
@@ -46,14 +46,14 @@ export interface Stylesheet {
46
46
  * loaded workbook keeps them; CT_Stylesheet puts all three after `<dxfs>`,
47
47
  * so the writer appends them there.
48
48
  */
49
- stylesXmlTail?: Array<import('../xml/tree').XmlNode>;
49
+ stylesXmlTail?: Array<import('../xml/tree.js').XmlNode>;
50
50
  _fontIdByKey: Map<string, number>;
51
51
  _fillIdByKey: Map<string, number>;
52
52
  _borderIdByKey: Map<string, number>;
53
53
  _xfIdByKey: Map<string, number>;
54
54
  _styleXfIdByKey: Map<string, number>;
55
55
  _numFmtIdByCode: Map<string, number>;
56
- _namedStyleByName?: Map<string, import('./named-styles').StylesheetNamedStyle>;
56
+ _namedStyleByName?: Map<string, import('./named-styles.js').StylesheetNamedStyle>;
57
57
  }
58
58
  /**
59
59
  * Build a fresh Stylesheet pre-populated with Excel's required default entries.
@@ -101,3 +101,29 @@ export declare function listCellStyleXfs(ss: Stylesheet): ReadonlyArray<CellXf>;
101
101
  * workbook's font 0 / fill 0 / border 0 / numFmtId 0 (General).
102
102
  */
103
103
  export declare function defaultCellXf(): CellXf;
104
+ /**
105
+ * A cell's look expressed across every style axis at once. Each axis is
106
+ * independent: pass any subset, and the axes you leave out are decided by
107
+ * whichever function consumes the spec.
108
+ */
109
+ export interface CellStyleSpec {
110
+ font?: Font;
111
+ fill?: Fill;
112
+ border?: Border;
113
+ alignment?: Alignment;
114
+ protection?: Protection;
115
+ numberFormat?: string;
116
+ }
117
+ /**
118
+ * Resolve a style spec to the CellXf fields it sets, registering each component
119
+ * in its pool. The result is a patch, not a whole xf: axes absent from `spec`
120
+ * are absent here too, so a caller can either spread it over
121
+ * {@link defaultCellXf} for a complete style or over an existing xf to merge.
122
+ *
123
+ * Every path that turns a user-facing style spec into an xf goes through this,
124
+ * so a new axis on {@link CellStyleSpec} reaches the modelled writer and the
125
+ * streaming write-only writer together.
126
+ */
127
+ export declare function buildXfPatch(ss: Stylesheet, spec: CellStyleSpec): {
128
+ -readonly [K in keyof CellXf]?: CellXf[K];
129
+ };
package/dist/styles.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { An as rotateHue, Cn as luminance, Dn as pickReadableTextColor, En as normaliseRgb, On as resolveIndexedColor, Sn as lighten, Tn as mixColors, _n as colorToHex, bn as hexToHsl, gn as adjustSaturation, hn as adjustLightness, kn as rgbColor, vn as contrastRatio, wn as makeColor, xn as hslToHex, yn as darken } from "./worksheet-C5Ensf_j.mjs";
2
- import { $ as ensureBuiltinStyle, A as setCellFill, At as makeNumberFormat, B as setRangeBackgroundColor, Bt as makeGradientFill, C as setCellAsCurrency, Ct as FORMAT_TEXT, D as setCellBackgroundColor, Dt as isBuiltinFormat, E as setCellAsPercent, Et as classifyDateFormat, F as setFontColor, Ft as fontToCss, G as setRangeStyle, Gt as makeBorder, H as setRangeFont, Ht as makePatternFill, I as setFontName, It as makeFont, J as setUnderline, K as setRangeWrapText, Kt as makeSide, L as setFontSize, M as setCellNumberFormat, N as setCellProtection, O as setCellBorder, Ot as isDateFormat, P as setCellStyle, Q as addNamedStyle, R as setItalic, Rt as fillToCss, S as setCellAlignment, St as FORMAT_PERCENTAGE_00, T as setCellAsNumber, Tt as builtinFormatId, U as setRangeNumberFormat, V as setRangeBorderBox, Vt as makeGradientStop, W as setRangeProtection, Wt as borderToCss, X as makeProtection, Xt as makeAlignment, Y as wrapCellText, Yt as alignmentToCss, Z as BUILTIN_NAMED_STYLES, _ as getCellNumberFormat, _t as FORMAT_DATE_YYYYMMDD2, a as cellStyleToCss, at as addNumFmt, b as rotateCellText, bt as FORMAT_NUMBER_00, c as clearCellStyle, ct as listCellStyleXfs, d as copyCellStyle, dt as listFonts, et as addBorder, f as formatAsHeader, ft as makeStylesheet, g as getCellFont, gt as FORMAT_DATE_TIMEDELTA, h as getCellFill, ht as FORMAT_DATE_DATETIME, i as applyNamedStyle, it as addFont, j as setCellFont, jt as DEFAULT_FONT, k as setCellBorderAll, kt as isTimedeltaFormat, l as clearRangeStyle, lt as listCellXfs, m as getCellBorder, mt as BUILTIN_FORMATS_MAX_SIZE, n as alignCellVertical, nt as addCellXf, o as centerCell, ot as defaultCellXf, p as getCellAlignment, pt as BUILTIN_FORMATS, q as setStrikethrough, r as applyBuiltinStyle, rt as addFill, s as clearCellBackground, st as listBorders, t as alignCellHorizontal, tt as addCellStyleXf, u as cloneCellStyle, ut as listFills, v as getCellProtection, vt as FORMAT_GENERAL, w as setCellAsDate, wt as builtinFormatCode, x as setBold, xt as FORMAT_PERCENTAGE, y as indentCell, yt as FORMAT_NUMBER, z as setRangeAlignment, zt as makeFill } from "./cell-style-DuvS_Lsg.mjs";
3
- import { r as makeDifferentialStyle, t as addDxf } from "./differential-DvKU8fJt.mjs";
4
- export { BUILTIN_FORMATS, BUILTIN_FORMATS_MAX_SIZE, BUILTIN_NAMED_STYLES, DEFAULT_FONT, FORMAT_DATE_DATETIME, FORMAT_DATE_TIMEDELTA, FORMAT_DATE_YYYYMMDD2, FORMAT_GENERAL, FORMAT_NUMBER, FORMAT_NUMBER_00, FORMAT_PERCENTAGE, FORMAT_PERCENTAGE_00, FORMAT_TEXT, addBorder, addCellStyleXf, addCellXf, addDxf, addFill, addFont, addNamedStyle, addNumFmt, adjustLightness, adjustSaturation, alignCellHorizontal, alignCellVertical, alignmentToCss, applyBuiltinStyle, applyNamedStyle, borderToCss, builtinFormatCode, builtinFormatId, cellStyleToCss, centerCell, classifyDateFormat, clearCellBackground, clearCellStyle, clearRangeStyle, cloneCellStyle, colorToHex, contrastRatio, copyCellStyle, darken, defaultCellXf, ensureBuiltinStyle, fillToCss, fontToCss, formatAsHeader, getCellAlignment, getCellBorder, getCellFill, getCellFont, getCellNumberFormat, getCellProtection, hexToHsl, hslToHex, indentCell, isBuiltinFormat, isDateFormat, isTimedeltaFormat, lighten, listBorders, listCellStyleXfs, listCellXfs, listFills, listFonts, luminance, makeAlignment, makeBorder, makeColor, makeDifferentialStyle, makeFill, makeFont, makeGradientFill, makeGradientStop, makeNumberFormat, makePatternFill, makeProtection, makeSide, makeStylesheet, mixColors, normaliseRgb, pickReadableTextColor, resolveIndexedColor, rgbColor, rotateCellText, rotateHue, setBold, setCellAlignment, setCellAsCurrency, setCellAsDate, setCellAsNumber, setCellAsPercent, setCellBackgroundColor, setCellBorder, setCellBorderAll, setCellFill, setCellFont, setCellNumberFormat, setCellProtection, setCellStyle, setFontColor, setFontName, setFontSize, setItalic, setRangeAlignment, setRangeBackgroundColor, setRangeBorderBox, setRangeFont, setRangeNumberFormat, setRangeProtection, setRangeStyle, setRangeWrapText, setStrikethrough, setUnderline, wrapCellText };
1
+ import { An as rgbColor, Cn as lighten, Dn as normaliseRgb, En as mixColors, On as pickReadableTextColor, Sn as hslToHex, Tn as makeColor, _n as adjustSaturation, bn as darken, gn as adjustLightness, jn as rotateHue, kn as resolveIndexedColor, vn as colorToHex, wn as luminance, xn as hexToHsl, yn as contrastRatio } from "./worksheet-4xW-i8j9.mjs";
2
+ import { $ as BUILTIN_NAMED_STYLES, $t as makeAlignment, A as setCellBorder, At as isBuiltinFormat, B as setItalic, C as setBold, Ct as FORMAT_NUMBER_00, D as setCellAsNumber, Dt as builtinFormatCode, E as setCellAsDate, Et as FORMAT_TEXT, F as setCellProtection, G as setRangeNumberFormat, Gt as makePatternFill, H as setRangeBackgroundColor, Ht as makeFill, I as setCellStyle, J as setRangeWrapText, Jt as makeBorder, K as setRangeProtection, L as setFontColor, M as setCellFill, Mt as isTimedeltaFormat, N as setCellFont, Nt as makeNumberFormat, O as setCellAsPercent, Ot as builtinFormatId, P as setCellNumberFormat, Pt as DEFAULT_FONT, Q as makeProtection, Qt as alignmentToCss, R as setFontName, Rt as fontToCss, S as rotateCellText, St as FORMAT_NUMBER, T as setCellAsCurrency, Tt as FORMAT_PERCENTAGE_00, U as setRangeBorderBox, Ut as makeGradientFill, V as setRangeAlignment, Vt as fillToCss, W as setRangeFont, Wt as makeGradientStop, X as setUnderline, Y as setStrikethrough, Yt as makeSide, Z as wrapCellText, _ as getCellNumberFormat, _t as BUILTIN_FORMATS_MAX_SIZE, a as cellStyleToCss, at as addFill, b as patchCellFont, bt as FORMAT_DATE_YYYYMMDD2, c as clearCellStyle, d as copyCellStyle, dt as listCellStyleXfs, et as addNamedStyle, f as formatAsHeader, ft as listCellXfs, g as getCellFont, gt as BUILTIN_FORMATS, h as getCellFill, ht as makeStylesheet, i as applyNamedStyle, it as addCellXf, j as setCellBorderAll, jt as isDateFormat, k as setCellBackgroundColor, kt as classifyDateFormat, l as clearRangeStyle, lt as defaultCellXf, m as getCellBorder, mt as listFonts, n as alignCellVertical, nt as addBorder, o as centerCell, ot as addFont, p as getCellAlignment, pt as listFills, q as setRangeStyle, qt as borderToCss, r as applyBuiltinStyle, rt as addCellStyleXf, s as clearCellBackground, st as addNumFmt, t as alignCellHorizontal, tt as ensureBuiltinStyle, u as cloneCellStyle, ut as listBorders, v as getCellProtection, vt as FORMAT_DATE_DATETIME, w as setCellAlignment, wt as FORMAT_PERCENTAGE, x as registerCellStyle, xt as FORMAT_GENERAL, y as indentCell, yt as FORMAT_DATE_TIMEDELTA, z as setFontSize, zt as makeFont } from "./cell-style-BFmJOmcx.mjs";
3
+ import { r as makeDifferentialStyle, t as addDxf } from "./differential-H9SjEeIU.mjs";
4
+ export { BUILTIN_FORMATS, BUILTIN_FORMATS_MAX_SIZE, BUILTIN_NAMED_STYLES, DEFAULT_FONT, FORMAT_DATE_DATETIME, FORMAT_DATE_TIMEDELTA, FORMAT_DATE_YYYYMMDD2, FORMAT_GENERAL, FORMAT_NUMBER, FORMAT_NUMBER_00, FORMAT_PERCENTAGE, FORMAT_PERCENTAGE_00, FORMAT_TEXT, addBorder, addCellStyleXf, addCellXf, addDxf, addFill, addFont, addNamedStyle, addNumFmt, adjustLightness, adjustSaturation, alignCellHorizontal, alignCellVertical, alignmentToCss, applyBuiltinStyle, applyNamedStyle, borderToCss, builtinFormatCode, builtinFormatId, cellStyleToCss, centerCell, classifyDateFormat, clearCellBackground, clearCellStyle, clearRangeStyle, cloneCellStyle, colorToHex, contrastRatio, copyCellStyle, darken, defaultCellXf, ensureBuiltinStyle, fillToCss, fontToCss, formatAsHeader, getCellAlignment, getCellBorder, getCellFill, getCellFont, getCellNumberFormat, getCellProtection, hexToHsl, hslToHex, indentCell, isBuiltinFormat, isDateFormat, isTimedeltaFormat, lighten, listBorders, listCellStyleXfs, listCellXfs, listFills, listFonts, luminance, makeAlignment, makeBorder, makeColor, makeDifferentialStyle, makeFill, makeFont, makeGradientFill, makeGradientStop, makeNumberFormat, makePatternFill, makeProtection, makeSide, makeStylesheet, mixColors, normaliseRgb, patchCellFont, pickReadableTextColor, registerCellStyle, resolveIndexedColor, rgbColor, rotateCellText, rotateHue, setBold, setCellAlignment, setCellAsCurrency, setCellAsDate, setCellAsNumber, setCellAsPercent, setCellBackgroundColor, setCellBorder, setCellBorderAll, setCellFill, setCellFont, setCellNumberFormat, setCellProtection, setCellStyle, setFontColor, setFontName, setFontSize, setItalic, setRangeAlignment, setRangeBackgroundColor, setRangeBorderBox, setRangeFont, setRangeNumberFormat, setRangeProtection, setRangeStyle, setRangeWrapText, setStrikethrough, setUnderline, wrapCellText };
@@ -1,23 +1,23 @@
1
1
  import { n as OpenXmlError, o as OpenXmlSchemaError } from "./exceptions-D-CFwxgm.mjs";
2
- import { a as columnLetterFromIndex, g as tupleToCoordinate, i as columnIndexFromLetter, s as coordinateToTuple } from "./coordinate-96Ecci4d.mjs";
3
- import { t as ERROR_CODES$1 } from "./inference-BrI9uIY4.mjs";
4
- import { E as setSharedFormula, S as setArrayFormula, T as setFormula, c as getCoordinate, w as setDataTableFormula } from "./cell-BucgGwl3.mjs";
2
+ import { a as columnLetterFromIndex, g as tupleToCoordinate, i as columnIndexFromLetter, s as coordinateToTuple } from "./coordinate-Bt5Gni2I.mjs";
3
+ import { r as normalizeFormulaText, t as ERROR_CODES$1 } from "./inference-BMvv9cUY.mjs";
4
+ import { A as setSharedFormula, E as setArrayFormula, O as setDataTableFormula, c as getCoordinate, k as setFormula } from "./cell-Df3cKRIl.mjs";
5
5
  import { C as makeSurface3DChart, S as makeStockChart, _ as makePie3DChart, a as makeArea3DChart, b as makeScatterChart, c as makeBarChart, d as makeBubbleSeries, f as makeChartSpace, g as makeOfPieChart, h as makeLineChart, l as makeBarSeries, m as makeLine3DChart, n as makeChartDrawing, o as makeAreaChart, p as makeDoughnutChart, s as makeBar3DChart, u as makeBubbleChart, v as makePieChart, w as makeSurfaceChart, x as makeScatterSeries, y as makeRadarChart } from "./user-shapes-DfmCGKB0.mjs";
6
6
  import { t as makeChartsheet } from "./chartsheet-C3-tqkPy.mjs";
7
- import { o as makeDrawing } from "./drawing-BxzLuryn.mjs";
7
+ import { o as makeDrawing } from "./drawing-ZJ3h4VHD.mjs";
8
8
  import { n as VALUED_COLOR_MOD_KINDS, r as VALUELESS_COLOR_MOD_KINDS, t as SCHEME_COLOR_NAMES } from "./colors-ovWAwnZI.mjs";
9
- import { n as escapeXmlAttr$1, r as escapeXmlText$1, t as escapeCellString } from "./escape-DFTE7ZJc.mjs";
9
+ import { n as escapeXmlAttr$1, r as escapeXmlText$1, t as escapeCellString } from "./escape-rnWSPpWY.mjs";
10
10
  import { H as DRAWING_NS, I as CX_NS, T as CHART_NS, a as findChildren, bt as X14_NS, dt as SHEET_DRAWING_NS, ft as SHEET_MAIN_NS, i as findChild, jt as qname, lt as REL_NS, n as el, q as MARKUP_COMPAT_NS, w as CHART_DRAWING_NS } from "./tree-BX-sRRVp.mjs";
11
- import { t as parseXml } from "./parser-D3SLaOFe.mjs";
11
+ import { t as parseXml } from "./parser-By6RWZVW.mjs";
12
12
  import { n as toTree, r as defineSchema, t as fromTree } from "./serialize-BC2Wu3bR.mjs";
13
- import { t as serializeXml } from "./serializer-BtO2TrI7.mjs";
14
- import { Q as findById } from "./manifest-Cm9K7D62.mjs";
15
- import { $t as makeRowDimension, Jt as makeLegacyComment, Qt as makeColumnDimension, Zt as makeSheetView, an as multiCellRangeToString, at as makeWorksheet, bt as setCell, dn as rangeToString, on as parseMultiCellRange, sn as parseRange, wn as makeColor } from "./worksheet-C5Ensf_j.mjs";
16
- import { Jt as VERTICAL_ALIGNMENTS, Lt as PATTERN_TYPES, Mt as FONT_SCHEMES, Nt as UNDERLINE_STYLES, Pt as VERT_ALIGNS, Ut as SIDE_STYLES, qt as HORIZONTAL_ALIGNMENTS } from "./cell-style-DuvS_Lsg.mjs";
17
- import { C as addSharedRichText, O as parseRichString, w as addSharedString } from "./workbook-CARZS94U.mjs";
18
- import { a as makeCfRule, i as makeDataValidation, n as makeTableColumn, o as makeConditionalFormatting, r as makeTableDefinition } from "./table-1P8we2gS.mjs";
13
+ import { t as serializeXml } from "./serializer-C6nm0mRJ.mjs";
14
+ import { Q as findById } from "./manifest-pLmx7KYh.mjs";
15
+ import { $t as makeColumnDimension, Qt as makeSheetView, Tn as makeColor, Yt as makeLegacyComment, cn as parseRange, en as makeRowDimension, fn as rangeToString, on as multiCellRangeToString, ot as makeWorksheet, sn as parseMultiCellRange, xt as setCell } from "./worksheet-4xW-i8j9.mjs";
16
+ import { Bt as PATTERN_TYPES, Ft as FONT_SCHEMES, It as UNDERLINE_STYLES, Kt as SIDE_STYLES, Lt as VERT_ALIGNS, Xt as HORIZONTAL_ALIGNMENTS, Zt as VERTICAL_ALIGNMENTS } from "./cell-style-BFmJOmcx.mjs";
17
+ import { C as addSharedRichText, O as parseRichString, w as addSharedString } from "./workbook-B15-T4cs.mjs";
18
+ import { a as makeCfRule, i as makeDataValidation, n as makeTableColumn, o as makeConditionalFormatting, r as makeTableDefinition } from "./table-Ccro4rrz.mjs";
19
19
  import { i as durationToExcel, r as dateToExcel } from "./datetime-B2ySVlXt.mjs";
20
- import { n as getDxfs } from "./differential-DvKU8fJt.mjs";
20
+ import { n as getDxfs } from "./differential-H9SjEeIU.mjs";
21
21
  //#region src/drawing/dml/effect.ts
22
22
  const PRESET_SHADOW_NAMES = [
23
23
  "shdw1",
@@ -6156,10 +6156,11 @@ const decodeCachedValue = (raw, t) => {
6156
6156
  };
6157
6157
  const handleFormula = (cell, fNode, coord, cached, sharedFormulas) => {
6158
6158
  const tAttr = fNode.attrs["t"] ?? "normal";
6159
- const formula = fNode.text ?? "";
6159
+ const formula = normalizeFormulaText(fNode.text ?? "");
6160
6160
  const opts = cached !== void 0 ? { cachedValue: cached } : void 0;
6161
6161
  switch (tAttr) {
6162
6162
  case "normal":
6163
+ if (formula.length === 0) throw new OpenXmlSchemaError(`worksheet: <f> at ${tupleToCoordinate(coord.col, coord.row)} has no formula text`);
6163
6164
  setFormula(cell, formula, opts);
6164
6165
  return;
6165
6166
  case "array": {
@@ -6185,8 +6186,7 @@ const handleFormula = (cell, fNode, coord, cached, sharedFormulas) => {
6185
6186
  const cache = sharedFormulas.get(si);
6186
6187
  if (!cache) throw new OpenXmlSchemaError(`worksheet: <f t="shared" si="${si}"/> with no preceding origin formula`);
6187
6188
  const dest = tupleToCoordinate(coord.col, coord.row);
6188
- const translated = translateFormula(`=${cache.formula}`, cache.origin, { dest });
6189
- setSharedFormula(cell, si, translated.startsWith("=") ? translated.slice(1) : translated, void 0, opts);
6189
+ setSharedFormula(cell, si, translateFormula(`=${cache.formula}`, cache.origin, { dest }), void 0, opts);
6190
6190
  return;
6191
6191
  }
6192
6192
  case "dataTable": {
@@ -6489,7 +6489,9 @@ function serializeWorksheet(ws, ctx) {
6489
6489
  parts.push(`<row r="${rowIdx}"${dimAttrs}>`);
6490
6490
  for (const colIdx of colKeys) {
6491
6491
  const cell = row.get(colIdx);
6492
- if (cell) parts.push(serializeCell(cell, ctx));
6492
+ if (!cell) continue;
6493
+ if (cell.styleId !== 0 && (!Number.isInteger(cell.styleId) || cell.styleId < 0 || cell.styleId >= ctx.styles.cellXfs.length)) throw unknownStyleId(cell, ws.title, ctx.styles.cellXfs.length);
6494
+ parts.push(serializeCell(cell, ctx));
6493
6495
  }
6494
6496
  parts.push("</row>");
6495
6497
  }
@@ -6587,6 +6589,15 @@ const serializeDimension = (ws) => {
6587
6589
  const col2 = colLetters(maxCol);
6588
6590
  return `<dimension ref="${minRow === maxRow && minCol === maxCol ? `${col1}${minRow}` : `${col1}${minRow}:${col2}${maxRow}`}"/>`;
6589
6591
  };
6592
+ /**
6593
+ * Excel resolves `<c s="n">` against `cellXfs`, and refuses to open a sheet
6594
+ * whose `n` names no entry: the file loads with the repair dialog and the sheet
6595
+ * is dropped. A `styleId` that leaves the pool it came from is the way to get
6596
+ * there, most often an id from `registerCellStyle` applied to a cell in a
6597
+ * different workbook, so refuse to emit rather than write a file Excel will
6598
+ * reject.
6599
+ */
6600
+ const unknownStyleId = (cell, sheetTitle, xfCount) => new OpenXmlSchemaError(`Cell ${getCoordinate(cell)} on sheet "${sheetTitle}" has styleId ${cell.styleId}, outside this workbook's cellXfs pool [0, ${xfCount}). A styleId is an index into one workbook's stylesheet; ids from registerCellStyle are valid only for the workbook that produced them.`);
6590
6601
  const colLetters = (n) => {
6591
6602
  let m = n;
6592
6603
  let out = "";
@@ -6651,7 +6662,9 @@ const serializeFormulaCell = (ref, styleAttr, f) => {
6651
6662
  if (f.aca) fAttrs.push("aca=\"1\"");
6652
6663
  if (f.ca) fAttrs.push("ca=\"1\"");
6653
6664
  const fAttrStr = fAttrs.length > 0 ? ` ${fAttrs.join(" ")}` : "";
6654
- const formulaText = escapeXmlText(escapeCellString(f.formula));
6665
+ const normalized = normalizeFormulaText(f.formula);
6666
+ if ((f.t === "normal" || f.t === "array") && normalized.length === 0) throw new OpenXmlSchemaError(`worksheet: ${f.t} formula must not be empty at ${ref}`);
6667
+ const formulaText = escapeXmlText(escapeCellString(normalized));
6655
6668
  const fEl = formulaText.length > 0 ? `<f${fAttrStr}>${formulaText}</f>` : `<f${fAttrStr}/>`;
6656
6669
  let valueAttr = "";
6657
6670
  let vEl = "";
@@ -6798,7 +6811,7 @@ const serializeCfRule = (rule) => {
6798
6811
  if (rule.stdDev !== void 0) attrs += ` stdDev="${rule.stdDev}"`;
6799
6812
  if (rule.timePeriod !== void 0) attrs += ` timePeriod="${rule.timePeriod}"`;
6800
6813
  const inner = [];
6801
- for (const f of rule.formulas) inner.push(`<formula>${escapeXmlText(f)}</formula>`);
6814
+ for (const f of rule.formulas) inner.push(`<formula>${escapeXmlText(normalizeFormulaText(f))}</formula>`);
6802
6815
  if (rule.innerXml) inner.push(rule.innerXml);
6803
6816
  if (inner.length === 0) return `<cfRule${attrs}/>`;
6804
6817
  return `<cfRule${attrs}>${inner.join("")}</cfRule>`;
@@ -6823,8 +6836,8 @@ const serializeDataValidation = (dv) => {
6823
6836
  if (dv.prompt !== void 0) attrs += ` prompt="${escapeXmlAttr(dv.prompt)}"`;
6824
6837
  attrs += ` sqref="${escapeXmlAttr(multiCellRangeToString(dv.sqref))}"`;
6825
6838
  const formulas = [];
6826
- if (dv.formula1 !== void 0) formulas.push(`<formula1>${escapeXmlText(dv.formula1)}</formula1>`);
6827
- if (dv.formula2 !== void 0) formulas.push(`<formula2>${escapeXmlText(dv.formula2)}</formula2>`);
6839
+ if (dv.formula1 !== void 0) formulas.push(`<formula1>${escapeXmlText(normalizeFormulaText(dv.formula1))}</formula1>`);
6840
+ if (dv.formula2 !== void 0) formulas.push(`<formula2>${escapeXmlText(normalizeFormulaText(dv.formula2))}</formula2>`);
6828
6841
  if (formulas.length === 0) return `<dataValidation${attrs}/>`;
6829
6842
  return `<dataValidation${attrs}>${formulas.join("")}</dataValidation>`;
6830
6843
  };
@@ -8709,4 +8722,4 @@ const cellXfToTree = (xf) => {
8709
8722
  //#endregion
8710
8723
  export { chartExToBytes as C, findUserShapesRId as D, chartToBytes as E, parseChartXml as O, userShapesToBytes as S, parseChartExXml as T, parseChartsheetXml as _, parseCommentsXml as a, parseWorksheetXml as b, NumberFormatSchema as c, BorderSchema as d, AlignmentSchema as f, chartsheetToBytes as g, parseDrawingXml as h, commentsToBytes as i, FontSchema as l, drawingToBytes as m, parseTableXml as n, placeholderVmlDrawing as o, collectRawRelIds as p, tableToBytes as r, ProtectionSchema as s, stylesheetToBytes as t, fillFromTree as u, serializeCell as v, isChartExBytes as w, parseUserShapesXml as x, worksheetToBytes as y };
8711
8724
 
8712
- //# sourceMappingURL=stylesheet-writer-BrOw4jMY.mjs.map
8725
+ //# sourceMappingURL=stylesheet-writer-D7Uug85X.mjs.map