@evotecit/officeimo 0.1.9 → 0.1.21

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 (43) hide show
  1. package/README.md +6 -3
  2. package/bundles/officeimo-canopyx-adapter.js +123 -61
  3. package/bundles/officeimo-canopyx-adapter.min.js +1 -1
  4. package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
  5. package/bundles/officeimo-canopyx-adapter.mjs +109 -48
  6. package/bundles/officeimo-canopyx.js +179 -102
  7. package/bundles/officeimo-canopyx.min.js +1 -1
  8. package/bundles/officeimo-canopyx.min.mjs +1 -1
  9. package/bundles/officeimo-canopyx.mjs +145 -69
  10. package/bundles/officeimo-datatables-adapter.js +7 -7
  11. package/bundles/officeimo-datatables-adapter.min.js +1 -1
  12. package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
  13. package/bundles/officeimo-datatables-adapter.mjs +3 -3
  14. package/bundles/officeimo-datatables.js +63 -48
  15. package/bundles/officeimo-datatables.min.js +1 -1
  16. package/bundles/officeimo-datatables.min.mjs +1 -1
  17. package/bundles/officeimo-datatables.mjs +39 -24
  18. package/bundles/officeimo-xlsx.js +59 -44
  19. package/bundles/officeimo-xlsx.min.js +1 -1
  20. package/bundles/officeimo-xlsx.min.mjs +1 -1
  21. package/bundles/officeimo-xlsx.mjs +39 -24
  22. package/bundles/officeimo.js +61 -46
  23. package/bundles/officeimo.min.js +1 -1
  24. package/bundles/officeimo.min.mjs +1 -1
  25. package/bundles/officeimo.mjs +40 -25
  26. package/dist/integrations/canopyx/index.js +4 -2
  27. package/dist/integrations/canopyx/metadata.js +1 -1
  28. package/dist/integrations/canopyx/pdf-number.js +9 -6
  29. package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
  30. package/dist/integrations/canopyx/rule-predicates.js +2 -1
  31. package/dist/integrations/canopyx/rules.d.ts +1 -1
  32. package/dist/integrations/canopyx/rules.js +11 -13
  33. package/dist/integrations/canopyx/source.js +44 -7
  34. package/dist/integrations/canopyx/tones.d.ts +10 -0
  35. package/dist/integrations/canopyx/tones.js +12 -0
  36. package/dist/integrations/canopyx/types.d.ts +10 -2
  37. package/dist/xlsx/options.js +1 -1
  38. package/dist/xlsx/portable.js +1 -1
  39. package/dist/xlsx/styles.js +28 -18
  40. package/dist/xlsx/types.d.ts +5 -1
  41. package/dist/xlsx/workbook.js +3 -1
  42. package/dist/xlsx/worksheet.js +5 -2
  43. package/package.json +1 -1
@@ -1928,6 +1928,24 @@ const { DifferentialStyles } = _m26;
1928
1928
 
1929
1929
 
1930
1930
  const spreadsheetNamespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
1931
+ const borderStyles = ["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"];
1932
+ /** @internal Validate and normalize border edges without registering a workbook style. */
1933
+ function normalizeBorder(border) {
1934
+ if (!border || typeof border !== "object")
1935
+ throw new TypeError("A border must be an object of edges.");
1936
+ const result = {};
1937
+ for (const side of ["left", "right", "top", "bottom"]) {
1938
+ const edge = border[side];
1939
+ if (edge) {
1940
+ // Read each property once, so the validated edge is the one that is stored.
1941
+ const { style, color } = edge;
1942
+ if (!borderStyles.includes(style))
1943
+ throw new TypeError("Invalid border style.");
1944
+ result[side] = { style, ...(color ? { color: colorArgb(color) } : {}) };
1945
+ }
1946
+ }
1947
+ return result;
1948
+ }
1931
1949
  const NumberFormats = { General: "General", Integer: "0", Decimal: "0.00", Percent: "0.00%", Date: "yyyy-mm-dd", DateTime: "yyyy-mm-dd hh:mm:ss" };
1932
1950
  function index(value, count, kind) {
1933
1951
  if (!Number.isInteger(value) || value < 0 || value >= count)
@@ -2000,32 +2018,24 @@ class StyleRegistry {
2000
2018
  /** @internal */
2001
2019
  addDifferentials(styles) { this.checkDifferentials(styles); return this.differential.add(styles); }
2002
2020
  addFont(font) {
2003
- if (font.name !== undefined && typeof font.name !== "string")
2021
+ const { name: requested, size: requestedSize, bold, italic, underline, strike, color } = font;
2022
+ if (requested !== undefined && typeof requested !== "string")
2004
2023
  throw new TypeError("Font name must be a string.");
2005
- const name = cleanXml(font.name ?? "Calibri", this.policy), size = font.size ?? 11;
2024
+ const name = cleanXml(requested ?? "Calibri", this.policy), size = requestedSize ?? 11;
2006
2025
  if (typeof name !== "string" || !name || name.length > 31)
2007
2026
  throw new TypeError("Font name must contain 1 through 31 characters.");
2008
2027
  if (!Number.isFinite(size) || size <= 0 || size > 409)
2009
2028
  throw new RangeError("Font size must be positive and at most 409.");
2010
- return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!font.bold, italic: !!font.italic, underline: !!font.underline, strike: !!font.strike, color: font.color ? colorArgb(font.color) : "" }, this.maximum);
2029
+ return deduplicate(this.fonts, this.fontIndexes, { name, size, bold: !!bold, italic: !!italic, underline: !!underline, strike: !!strike, color: color ? colorArgb(color) : "" }, this.maximum);
2011
2030
  }
2012
2031
  addFill(fill) {
2013
- const pattern = fill.pattern ?? (fill.color ? "solid" : "none");
2014
- if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !fill.color) || (pattern !== "solid" && fill.color))
2032
+ const { color } = fill, pattern = fill.pattern ?? (color ? "solid" : "none");
2033
+ if (!["none", "gray125", "solid"].includes(pattern) || (pattern === "solid" && !color) || (pattern !== "solid" && color))
2015
2034
  throw new TypeError("A solid fill requires a color; none and gray125 have no color.");
2016
- return deduplicate(this.fills, this.fillIndexes, { pattern, color: fill.color ? colorArgb(fill.color) : "" }, this.maximum + 1);
2035
+ return deduplicate(this.fills, this.fillIndexes, { pattern, color: color ? colorArgb(color) : "" }, this.maximum + 1);
2017
2036
  }
2018
2037
  addBorder(border) {
2019
- const result = {};
2020
- for (const side of ["left", "right", "top", "bottom"]) {
2021
- const edge = border[side];
2022
- if (edge) {
2023
- if (!["thin", "medium", "dashed", "dotted", "thick", "double", "hair", "dashDot", "dashDotDot", "slantDashDot", "mediumDashed", "mediumDashDot", "mediumDashDotDot"].includes(edge.style))
2024
- throw new TypeError("Invalid border style.");
2025
- result[side] = { style: edge.style, ...(edge.color ? { color: colorArgb(edge.color) } : {}) };
2026
- }
2027
- }
2028
- return deduplicate(this.borders, this.borderIndexes, result, this.maximum);
2038
+ return deduplicate(this.borders, this.borderIndexes, normalizeBorder(border), this.maximum);
2029
2039
  }
2030
2040
  addNumberFormat(format) {
2031
2041
  if (typeof format !== "string" || !format || format.length > 255)
@@ -2091,7 +2101,7 @@ class StyleRegistry {
2091
2101
  return this.compose(base, { numberFormat: this.styles[this.validateStyle(dateStyle)].numberFormat });
2092
2102
  }
2093
2103
  /** @internal Column shorthand and header style composition. */
2094
- forColumn(column, header = false, fill, date = false) {
2104
+ forColumn(column, header = false, fill, date = false, border) {
2095
2105
  const base = !header && column.style !== undefined ? this.styles[this.validateStyle(column.style)] : undefined;
2096
2106
  const format = column.format !== undefined ? column.format || NumberFormats.General : base?.numberFormat || (column.type === "date" || date ? NumberFormats.DateTime : NumberFormats.General);
2097
2107
  return this.add({
@@ -2100,7 +2110,7 @@ class StyleRegistry {
2100
2110
  wrapText: column.wrapText ?? base?.wrapText ?? false,
2101
2111
  ...(column.alignment ? { alignment: column.alignment } : base?.alignment ? { alignment: base.alignment } : {}),
2102
2112
  ...(base?.verticalAlignment ? { verticalAlignment: base.verticalAlignment } : {}),
2103
- ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {})
2113
+ ...(header ? { font: { bold: true } } : {}), ...(fill ? { fill: { color: fill } } : {}), ...(border ? { border } : {})
2104
2114
  });
2105
2115
  }
2106
2116
  toXml() {
@@ -2125,7 +2135,7 @@ class StyleRegistry {
2125
2135
  }).join("") + '</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' + this.differential.toXml() + '</styleSheet>';
2126
2136
  }
2127
2137
  }
2128
- const _exports = Object.freeze({ colorArgb: _m25.colorArgb, spreadsheetNamespace: spreadsheetNamespace, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2138
+ const _exports = Object.freeze({ colorArgb: _m25.colorArgb, spreadsheetNamespace: spreadsheetNamespace, normalizeBorder: normalizeBorder, NumberFormats: NumberFormats, validateStylePatch: validateStylePatch, copyStylePatch: copyStylePatch, StyleRegistry: StyleRegistry });
2129
2139
  return _exports;
2130
2140
  })();
2131
2141
 
@@ -3443,8 +3453,9 @@ class Worksheet {
3443
3453
  book.checkLinks(this.links.length);
3444
3454
  this.declared = this.columns.map((column, i) => ({ column, letter: columnName(i + 1),
3445
3455
  style: book.styles.forColumn(column), dateStyle: book.styles.forColumn(column, false, undefined, true),
3446
- headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header, ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }),
3447
- ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill) : 0
3456
+ headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
3457
+ ...((options.headerWrap ?? column.wrapText) === undefined ? {} : { wrapText: options.headerWrap ?? column.wrapText }),
3458
+ ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill, false, options.headerBorder) : 0
3448
3459
  }));
3449
3460
  // Register conditional styles only after worksheet construction can no longer reject its options.
3450
3461
  this.conditional = new ConditionalFormats(conditional, book.styles);
@@ -3496,6 +3507,8 @@ class Worksheet {
3496
3507
  throw new TypeError("A frozen header or autofilter requires a header row.");
3497
3508
  if (options.headerFill !== undefined)
3498
3509
  colorArgb(options.headerFill);
3510
+ if (options.headerWrap !== undefined && typeof options.headerWrap !== "boolean")
3511
+ throw new TypeError("headerWrap must be boolean.");
3499
3512
  if (options.headerStyle !== undefined)
3500
3513
  book.styles.validateStyle(options.headerStyle);
3501
3514
  if (options.alternatingRowStyle !== undefined)
@@ -4186,7 +4199,7 @@ const { captureFields } = _m10;
4186
4199
  /** @internal The workbook owner captures these settings before validation or adapter merging. */
4187
4200
  const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
4188
4201
  /** @internal Worksheet settings also used by the portable sheet owner. */
4189
- const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
4202
+ const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerBorder", "headerWrap", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
4190
4203
  /** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
4191
4204
  const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
4192
4205
  /** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
@@ -4518,7 +4531,7 @@ const { OpcPackage, officeRelationshipsNamespace, relationshipTypes, corePropert
4518
4531
 
4519
4532
  const { escapeOoxmlAttribute, cleanXml, xmlDeclaration } = _m17;
4520
4533
 
4521
- const { StyleRegistry, spreadsheetNamespace } = _m24;
4534
+ const { StyleRegistry, spreadsheetNamespace, normalizeBorder } = _m24;
4522
4535
 
4523
4536
  const { sheetName, assertXlsxValue, copyValue } = _m27;
4524
4537
 
@@ -4559,6 +4572,8 @@ function captureSheet(options, policy) {
4559
4572
  return { ...captured, columns,
4560
4573
  ...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
4561
4574
  ...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
4575
+ // Preflight and every header style read this one snapshot of the edges.
4576
+ ...(captured.headerBorder === undefined ? {} : { headerBorder: normalizeBorder(captured.headerBorder) }),
4562
4577
  ...(footer ? { footer: { ...footer,
4563
4578
  ...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
4564
4579
  ...(footer.values === undefined ? {} : { values: footer.values.map(copyValue) }) } } : {}),
@@ -5009,7 +5024,7 @@ function value(result) {
5009
5024
  function portableSheet(options = {}) {
5010
5025
  options = captureFields(options, sheetOptionFields);
5011
5026
  if (options.headerStyle !== undefined)
5012
- throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader and headerFill.");
5027
+ throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader, headerFill, headerBorder and headerWrap.");
5013
5028
  style(options.alternatingRowStyle);
5014
5029
  style(options.title?.style);
5015
5030
  style(options.footer?.style);
@@ -11536,6 +11551,6 @@ const _m0 = (() => {
11536
11551
  const _exports = Object.freeze({ core: _m1, zip: _m14, xml: _m17, opc: _m18, xlsx: _m21, csv: _m50, pdf: _m54, Workbook: _m21.Workbook, Worksheet: _m21.Worksheet, Cell: _m21.Cell, FormulaCell: _m21.FormulaCell, StyleRegistry: _m21.StyleRegistry, NumberFormats: _m21.NumberFormats, writeXlsx: _m21.writeXlsx, writeXlsxTo: _m21.writeXlsxTo, writeCsv: _m50.writeCsv, writeCsvTo: _m50.writeCsvTo, createGroupedReport: _m8.createGroupedReport, writeGroupedXlsx: _m48.writeGroupedXlsx, writeGroupedXlsxTo: _m48.writeGroupedXlsxTo, addGroupedXlsx: _m48.addGroupedXlsx, writeGroupedPdf: _m83.writeGroupedPdf, writeGroupedPdfTo: _m83.writeGroupedPdfTo, pdfGroupedTable: _m83.pdfGroupedTable, writePdf: _m54.writePdf, writePdfTo: _m54.writePdfTo, writePdfDocument: _m54.writePdfDocument, writePdfDocumentTo: _m54.writePdfDocumentTo, pdfTable: _m54.pdfTable, PdfFont: _m54.PdfFont, preflightPdfText: _m54.preflightPdfText, OfficeIMOError: _m1.OfficeIMOError, NotSupportedError: _m1.NotSupportedError, detectFeatures: _m1.detectFeatures, saveBlob: _m1.saveBlob, ExportCell: _m1.ExportCell });
11537
11552
  return _exports;
11538
11553
  })();
11539
- const __officeimoModules = Object.freeze({ "81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00": _m1, "6cfd3e806439f6301003a2d1699a74fdfa574d935550ab62b97b528728eaee1f": _m23, "b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4": _m50, "d6587a933b36ccfdba9a2a252389924ac8461f672b3a500082cceb5e53c8b0b6": _m21, "027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe": _m54, "a10003e971cd5ec2cee127bc9b029a0aa06fe3d50112838929d7a04a55e177c0": _m47, "732224f6995c2478cf33a6ed01f3e3d3dcccb159a731d6db9280104bd5040fc5": _m5, "d56b24243cff6f3552a2f7b45521af4491494375ec76117e9ac1ebb047ce02da": _m30, "87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3": _m4, "42faf379960e5674a6fdfa8c8fca0bb68bbd74587231248d2524d7004def3671": _m9, "50b3c10b690ceff693c8c5f809195ba6845b20e60f408e791a750d2ecbd5c669": _m10, "0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc": _m11, "f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208": _m53, "4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38": _m56, "477ff98f49343b8ec4213008254b57a60dd42d07cb9843b3791d5e5f8e295865": _m43, "d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596": _m63, "e88a83ca79cd099fc2de29689554c913c7d04b17018098f81c43044064fcdfb8": _m27, "046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0": _m8, "c9fde2c438e186da56f740105fcd41c265fdfdd855a4f1b811d556a02387479b": _m12, "227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585": _m17, "5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b": _m3, "59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070": _m67 });
11554
+ const __officeimoModules = Object.freeze({ "81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00": _m1, "6cfd3e806439f6301003a2d1699a74fdfa574d935550ab62b97b528728eaee1f": _m23, "b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4": _m50, "e5310c591178a3de9292f150e2e6f1477b94b895ef0c90840c72adef00f75974": _m21, "027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe": _m54, "62ff1bcbf8ca07e8ab92cd1f6afbd54049346193e18160ab0afec48e03950bba": _m47, "732224f6995c2478cf33a6ed01f3e3d3dcccb159a731d6db9280104bd5040fc5": _m5, "d56b24243cff6f3552a2f7b45521af4491494375ec76117e9ac1ebb047ce02da": _m30, "87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3": _m4, "42faf379960e5674a6fdfa8c8fca0bb68bbd74587231248d2524d7004def3671": _m9, "50b3c10b690ceff693c8c5f809195ba6845b20e60f408e791a750d2ecbd5c669": _m10, "0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc": _m11, "f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208": _m53, "4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38": _m56, "8f13b484030aa6b921e616d803614fd061f718241692003633375fab4c36045e": _m43, "d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596": _m63, "e88a83ca79cd099fc2de29689554c913c7d04b17018098f81c43044064fcdfb8": _m27, "046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0": _m8, "c9fde2c438e186da56f740105fcd41c265fdfdd855a4f1b811d556a02387479b": _m12, "227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585": _m17, "5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b": _m3, "59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070": _m67 });
11540
11555
  const { core, zip, xml, opc, xlsx, csv, pdf, Workbook, Worksheet, Cell, FormulaCell, StyleRegistry, NumberFormats, writeXlsx, writeXlsxTo, writeCsv, writeCsvTo, createGroupedReport, writeGroupedXlsx, writeGroupedXlsxTo, addGroupedXlsx, writeGroupedPdf, writeGroupedPdfTo, pdfGroupedTable, writePdf, writePdfTo, writePdfDocument, writePdfDocumentTo, pdfTable, PdfFont, preflightPdfText, OfficeIMOError, NotSupportedError, detectFeatures, saveBlob, ExportCell } = _m0;
11541
11556
  export { core, zip, xml, opc, xlsx, csv, pdf, Workbook, Worksheet, Cell, FormulaCell, StyleRegistry, NumberFormats, writeXlsx, writeXlsxTo, writeCsv, writeCsvTo, createGroupedReport, writeGroupedXlsx, writeGroupedXlsxTo, addGroupedXlsx, writeGroupedPdf, writeGroupedPdfTo, pdfGroupedTable, writePdf, writePdfTo, writePdfDocument, writePdfDocumentTo, pdfTable, PdfFont, preflightPdfText, OfficeIMOError, NotSupportedError, detectFeatures, saveBlob, ExportCell, __officeimoModules };
@@ -16,6 +16,7 @@ import { withCanopyPdfLayout } from "./pdf-layout.js";
16
16
  export { createCanopyExport } from "./source.js";
17
17
  export { ExportCell } from "../../core/presentation.js";
18
18
  export { PdfFont } from "../../pdf/font.js";
19
+ const canopyHeaderFill = "E7EDF5", canopyHeaderBorder = Object.freeze({ bottom: Object.freeze({ style: "thin", color: "A6B4C8" }) });
19
20
  /** Write a captured CanopyX grid to a caller-owned destination; partial bytes remain caller-owned on failure. */
20
21
  export async function writeCanopyTo(capture, format, destination, options = {}) {
21
22
  const selected = captureFields(options, ["tones", "columnOptions", "unsupportedPresentation", "datetime", "xlsx", "csv", "pdf", "signal", "onDiagnostic", "limits", "onProgress", "grouped", "about"]);
@@ -55,13 +56,14 @@ export async function writeCanopyTo(capture, format, destination, options = {})
55
56
  const stream = { ...(signal ? { signal } : {}), ...progress };
56
57
  if (format === "xlsx") {
57
58
  const formatLimits = mergeAdapterLimits(xlsx.limits, limits), grouped = pivot ? undefined : canopyGrouped(source, request, { ...selected, xlsx }, formatLimits, report, format);
58
- const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes);
59
+ const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes, prepared.ruleOperands);
59
60
  if (pivot && (xlsx.sheet?.rowOutline !== undefined || xlsx.sheet?.columnOutlines !== undefined || xlsx.sheet?.maxOutlineLevel !== undefined ||
60
61
  xlsx.sheet?.outlineSummaryBelow !== undefined || xlsx.sheet?.outlineSummaryRight !== undefined || xlsx.sheet?.table !== undefined || xlsx.sheet?.footer !== undefined))
61
62
  throw new TypeError("Captured pivot metadata owns outlines and totals; worksheet overrides cannot regroup or recalculate it.");
62
63
  if (pivot && xlsx.cellValueWriters !== undefined)
63
64
  throw new TypeError("Captured pivot exports use frozen values rather than custom cellValueWriters.");
64
- const sheet = { ...xlsx.sheet, ...(pivot?.sheet ?? {}), ...(pivot ? { autoFilter: false } : {}),
65
+ // The header matches the PDF table heading: shaded, bold, wrapped and ruled off from the data.
66
+ const sheet = { headerFill: canopyHeaderFill, headerBorder: canopyHeaderBorder, headerWrap: true, ...xlsx.sheet, ...(pivot?.sheet ?? {}), ...(pivot ? { autoFilter: false } : {}),
65
67
  freezeHeader: xlsx.sheet?.freezeHeader ?? (xlsx.sheet?.includeHeader !== false),
66
68
  freezeColumns: xlsx.sheet?.freezeColumns ?? (pinned ? pinned + (grouped ? 1 : 0) : 0),
67
69
  conditionalFormats: [...rules, ...(xlsx.sheet?.conditionalFormats ?? [])] };
@@ -4,7 +4,7 @@ import { cleanXml } from "../../xml/index.js";
4
4
  export function canopyAbout(request, options) {
5
5
  const result = [["revision", request.revision], ["recordCount", request.recordCount === null ? "unknown" : request.recordCount]];
6
6
  if (request.scope !== undefined) {
7
- if (!["filtered", "selected", "all"].includes(request.scope))
7
+ if (!["filtered", "visible", "selected", "all"].includes(request.scope))
8
8
  throw new TypeError("Invalid Canopy export scope.");
9
9
  result.push(["scope", request.scope]);
10
10
  }
@@ -1,4 +1,5 @@
1
1
  import { ExportCell } from "../../core/index.js";
2
+ import { canopyBadgeSplit } from "./source.js";
2
3
  /** Fixed numeric formats affect PDF text, not the frozen numeric value used by other writers. */
3
4
  function numericProfile(format) {
4
5
  // No declared precision: whole values (including counts) stay whole.
@@ -46,11 +47,11 @@ function documentDecimal(sample, columns) {
46
47
  const profile = numericProfile(cell.presentation?.numberFormat ?? column.format);
47
48
  if (!profile)
48
49
  continue;
49
- const captured = capturedNumber(cell.text ?? "", profile);
50
+ const label = canopyBadgeSplit(cell).text, captured = capturedNumber(label, profile);
50
51
  if (!captured)
51
52
  continue;
52
53
  // A literal percent label is a culture signal without requesting numeric scaling.
53
- const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") || (cell.text ?? "").includes("%");
54
+ const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") || label.includes("%");
54
55
  if (percentageSignal !== percent)
55
56
  continue;
56
57
  const match = /([.,])(\d+)$/.exec(captured.number.trimEnd());
@@ -77,10 +78,12 @@ export function canopyPdfNumbers(sample, columns) {
77
78
  return value;
78
79
  const format = value.presentation?.numberFormat ?? columns[index].format;
79
80
  let profile = numericProfile(format);
80
- if (!profile || value.text === "")
81
+ // Badge labels are not part of the number: format the captured label alone, then append them unchanged.
82
+ const { text: label, suffix: badges } = canopyBadgeSplit(value);
83
+ if (!profile || label === "")
81
84
  return value;
82
- const captured = capturedNumber(value.text ?? "", profile);
83
- if (value.text && !captured)
85
+ const captured = capturedNumber(label, profile);
86
+ if (label && !captured)
84
87
  return value;
85
88
  // Undeclared formats normalize only plain numeric labels; a decoration
86
89
  // alone does not declare how the raw value was transformed for display.
@@ -112,7 +115,7 @@ export function canopyPdfNumbers(sample, columns) {
112
115
  let suffix = captured?.suffix || profile.suffix;
113
116
  if (profile.percent && !profile.suffix)
114
117
  suffix = suffix.replace(/%/g, "");
115
- return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix,
118
+ return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix + badges,
116
119
  ...(value.presentation ? { presentation: value.presentation } : {}), ...(value.link ? { link: value.link } : {}) });
117
120
  });
118
121
  }
@@ -1,3 +1,3 @@
1
1
  import type { CanopyCapture, CanopyRulePredicate, CanopySourceOptions } from "./types.js";
2
2
  /** Compile only comparisons whose raw types and native encodings have a faithful bounded mapping. */
3
- export declare function canopyPredicate(request: CanopyCapture["request"], grouped: boolean, options: CanopySourceOptions, root: CanopyRulePredicate, unsupported: (code: string) => never, cellTypes: Map<number, "number" | "date">): string;
3
+ export declare function canopyPredicate(request: CanopyCapture["request"], grouped: boolean, options: CanopySourceOptions, root: CanopyRulePredicate, unsupported: (code: string) => never, cellTypes: Map<number, "number" | "date">, operands?: Set<string>): string;
@@ -2,7 +2,7 @@ import { columnName, excelDate } from "../../xlsx/values.js";
2
2
  import { captureFields } from "../../internal/capture.js";
3
3
  import { datetime } from "./dates.js";
4
4
  /** Compile only comparisons whose raw types and native encodings have a faithful bounded mapping. */
5
- export function canopyPredicate(request, grouped, options, root, unsupported, cellTypes) {
5
+ export function canopyPredicate(request, grouped, options, root, unsupported, cellTypes, operands) {
6
6
  let nodes = 0;
7
7
  const operations = { eq: "=", ne: "<>", gt: ">", ge: ">=", lt: "<", le: "<=" };
8
8
  const numeric = (value) => {
@@ -49,6 +49,7 @@ export function canopyPredicate(request, grouped, options, root, unsupported, ce
49
49
  const index = request.columns.findIndex(column => column.id === filter.column);
50
50
  if (index < 0)
51
51
  return unsupported("RULE_COLUMN_NOT_EXPORTED:" + filter.column);
52
+ operands?.add(filter.column);
52
53
  const column = request.columns[index], letter = columnName(index + 1 + (grouped ? 1 : 0));
53
54
  const reference = "INDEX($" + letter + ":$" + letter + ",ROW())", present = "NOT(ISBLANK(" + reference + "))";
54
55
  if (column.kind === "number")
@@ -3,4 +3,4 @@ import type { ConditionalFormat } from "../../xlsx/index.js";
3
3
  import type { CanopyCapture, CanopyDiagnostic, CanopyFormat, CanopySourceOptions } from "./types.js";
4
4
  /** Compile declarations in source order, then emit native target/aspect priorities.
5
5
  * Data-column selectors let grouped writers exclude generated headings, subtotals and grand totals. */
6
- export declare function canopyRules(request: CanopyCapture["request"], format: CanopyFormat, grouped: boolean, tones: ReadonlyMap<string, Readonly<CellPresentation>>, report: (diagnostic: CanopyDiagnostic) => void, options?: CanopySourceOptions, cellTypes?: Map<number, "number" | "date">): readonly ConditionalFormat[];
6
+ export declare function canopyRules(request: CanopyCapture["request"], format: CanopyFormat, grouped: boolean, tones: ReadonlyMap<string, Readonly<CellPresentation>>, report: (diagnostic: CanopyDiagnostic) => void, options?: CanopySourceOptions, cellTypes?: Map<number, "number" | "date">, operands?: Set<string>): readonly ConditionalFormat[];
@@ -1,18 +1,12 @@
1
1
  import { captureFields } from "../../internal/capture.js";
2
2
  import { canopyPredicate } from "./rule-predicates.js";
3
- // Stable document palette. Browser CSS variables and resolved cell.format are never interpreted.
4
- const palette = {
5
- info: { color: "4472C4", background: "DDEBF7", foreground: "1F4E78" },
6
- success: { color: "70AD47", background: "E2F0D9", foreground: "375623" },
7
- warning: { color: "FFC000", background: "FFF2CC", foreground: "9C6500" },
8
- danger: { color: "C00000", background: "FFC7CE", foreground: "9C0006" }
9
- };
3
+ import { canopyDefaultTones, canopyTonePalette as palette } from "./tones.js";
10
4
  class UnsupportedRule extends Error {
11
5
  }
12
6
  const unsupported = (message) => { throw new UnsupportedRule(message); };
13
7
  /** Compile declarations in source order, then emit native target/aspect priorities.
14
8
  * Data-column selectors let grouped writers exclude generated headings, subtotals and grand totals. */
15
- export function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes) {
9
+ export function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes, operands) {
16
10
  if (request.formatRules === undefined || format === "csv")
17
11
  return [];
18
12
  if (!Array.isArray(request.formatRules) || request.formatRules.length > 1000)
@@ -51,7 +45,7 @@ export function canopyRules(request, format, grouped, tones, report, options = {
51
45
  }
52
46
  const priorStops = [];
53
47
  const priorRows = [], priorCells = new Map();
54
- const requiredCells = new Map();
48
+ const requiredCells = new Map(), emittedOperands = new Set();
55
49
  const column = (id) => {
56
50
  const index = columns.findIndex(column => column.id === id);
57
51
  if (index < 0)
@@ -69,8 +63,7 @@ export function canopyRules(request, format, grouped, tones, report, options = {
69
63
  return value;
70
64
  };
71
65
  const style = (name) => {
72
- const defaults = palette[name];
73
- const mapping = tones.get(name) ?? (defaults ? { background: defaults.background, color: defaults.foreground } : undefined);
66
+ const mapping = tones.get(name) ?? canopyDefaultTones.get(name);
74
67
  if (!mapping)
75
68
  return unsupported("UNMAPPED_RULE_TONE:" + name);
76
69
  if ("alignment" in mapping || "wrapText" in mapping)
@@ -143,8 +136,8 @@ export function canopyRules(request, format, grouped, tones, report, options = {
143
136
  const range = rule.target === "row" ? { column: columns[0].id, through: columns.at(-1).id } : { column: rule.column };
144
137
  if (rule.column !== undefined)
145
138
  column(rule.column);
146
- const ruleCells = new Map();
147
- const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells);
139
+ const ruleCells = new Map(), ruleOperands = new Set();
140
+ const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells, ruleOperands);
148
141
  const reachable = priorStops.length ? "AND(" + ownPredicate + ",NOT(OR(" + priorStops.join(",") + ")))" : ownPredicate;
149
142
  const previous = rule.target === "row" ? priorRows : priorCells.get(rule.column) ?? [];
150
143
  const formula = previous.length ? "AND(" + reachable + ",NOT(OR(" + previous.join(",") + ")))" : reachable;
@@ -156,6 +149,8 @@ export function canopyRules(request, format, grouped, tones, report, options = {
156
149
  priorCells.set(rule.column, previous);
157
150
  for (const [column, type] of ruleCells)
158
151
  requiredCells.set(column, type);
152
+ for (const id of ruleOperands)
153
+ emittedOperands.add(id);
159
154
  // A matched declaration still stops the row when an earlier tone on that target already won.
160
155
  if (rule.stopIfTrue)
161
156
  priorStops.push(ownPredicate);
@@ -171,6 +166,9 @@ export function canopyRules(request, format, grouped, tones, report, options = {
171
166
  }
172
167
  for (const [column, type] of requiredCells)
173
168
  cellTypes?.set(column, type);
169
+ // Only emitted rules read raw cells; a rejected comparison leaves its column free to carry badge labels.
170
+ for (const id of emittedOperands)
171
+ operands?.add(id);
174
172
  // Canopy paints cell visuals/tones over the row tint. Build masks before changing native priority order.
175
173
  return Object.freeze([...visuals, ...cells, ...rows]);
176
174
  }
@@ -6,8 +6,20 @@ import { copyColumns } from "../../internal/rows.js";
6
6
  import { copyCellPresentation } from "../../core/presentation.js";
7
7
  import { canopyDiagnostics } from "./diagnostics.js";
8
8
  import { canopyNumberFormat, canopyXlsxWidth } from "./presentation.js";
9
+ import { canopyDefaultTones } from "./tones.js";
9
10
  const columnFields = ["width", "format", "wrapText", "alignment", "rowHeader", "groups"];
11
+ // Captured presentations whose cell text already carries the readable content (badge labels are appended below).
12
+ // Their visual loss is reported, never treated as an unsupported export.
13
+ const textFallbacks = new Set(["relative-link", "history-series", "badges", "custom-class", "custom-renderer"]);
14
+ const badgeSeparator = " \u00b7 ";
10
15
  const rawIdentities = new WeakMap();
16
+ // Appended badge labels, kept apart so later passes that re-render a cell's text (PDF numbers) can carry them over.
17
+ const badgeSuffixes = new WeakMap();
18
+ /** @internal The text a later pass may re-render, and the badge suffix it must append back unchanged. */
19
+ export function canopyBadgeSplit(cell) {
20
+ const suffix = badgeSuffixes.get(cell), text = cell.text ?? "";
21
+ return suffix !== undefined && text.endsWith(suffix) ? { text: text.slice(0, text.length - suffix.length), suffix } : { text, suffix: "" };
22
+ }
11
23
  /** @internal Grouping uses captured identity even when a detail cell displays a relative-link label. */
12
24
  export function canopyIdentityValue(value) {
13
25
  if (!(value instanceof ExportCell))
@@ -15,6 +27,20 @@ export function canopyIdentityValue(value) {
15
27
  const original = rawIdentities.get(value);
16
28
  return original === undefined ? value.value : original;
17
29
  }
30
+ function badgeText(input) {
31
+ if (!Array.isArray(input) || input.length > 64)
32
+ throw new TypeError("Canopy cell badges must be a bounded array of { text, tone?, title? }.");
33
+ const labels = [];
34
+ for (const badge of input) {
35
+ const text = typeof badge === "string" ? badge : badge && typeof badge === "object" ? badge.text : undefined;
36
+ if (typeof text !== "string")
37
+ throw new TypeError("Canopy cell badges must be a bounded array of { text, tone?, title? }.");
38
+ const label = text.trim();
39
+ if (label)
40
+ labels.push(label);
41
+ }
42
+ return labels.length ? labels.join(badgeSeparator) : undefined;
43
+ }
18
44
  /** Map an immutable CanopyX record capture to a writer without querying the grid or retaining its body. */
19
45
  export function createCanopyExport(capture, format, options = {}) {
20
46
  return prepareCanopyExport(capture, format, options).source;
@@ -48,7 +74,7 @@ export function prepareCanopyExport(capture, format, options = {}) {
48
74
  throw new TypeError("Canopy presentation diagnostics must be strings.");
49
75
  for (const code of items) {
50
76
  const diagnostic = { code, ...(rowId === undefined ? {} : { rowId }), ...(columnId === undefined ? {} : { columnId }) };
51
- (code === "relative-link" || code === "history-series" ? fallback : report)(diagnostic);
77
+ (textFallbacks.has(code) ? fallback : report)(diagnostic);
52
78
  }
53
79
  };
54
80
  if (request.presentation !== "text" && request.presentation !== "semantic")
@@ -63,11 +89,13 @@ export function prepareCanopyExport(capture, format, options = {}) {
63
89
  return undefined;
64
90
  if (typeof name !== "string")
65
91
  throw new TypeError("Canopy tones must be strings.");
66
- const style = tones.get(name);
92
+ const style = tones.get(name) ?? canopyDefaultTones.get(name);
67
93
  if (!style && name !== "neutral")
68
94
  fallback({ code: "UNMAPPED_TONE:" + name, rowId, ...(columnId === undefined ? {} : { columnId }) });
69
95
  return style;
70
96
  };
97
+ // The full writer fills this with columns read by the native rules it emits, before any row is enumerated.
98
+ const ruleOperands = new Set();
71
99
  const ids = new Set();
72
100
  const specs = (pivot?.columns ?? request.columns).map(input => {
73
101
  const fields = captureFields(input, ["id", "title", "kind", "width", "pinned", "format", "wrap", "alignment", "diagnostics"]);
@@ -126,8 +154,14 @@ export function prepareCanopyExport(capture, format, options = {}) {
126
154
  diagnostics(cell.diagnostics, row.id, spec.id);
127
155
  // A relative destination is navigation metadata, not the visible label.
128
156
  // History captures already carry their frozen latest scalar (or null).
129
- const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link");
130
- let value = values === "display" || relativeLabel ? cell.text : cell.value;
157
+ // Columns read by an emitted native rule keep the raw scalar the rule compares, so the label goes to the text only.
158
+ const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link") && !ruleOperands.has(spec.id);
159
+ const badges = cell.badges === undefined ? undefined : badgeText(cell.badges);
160
+ const text = badges ? cell.text ? cell.text + badgeSeparator + badges : badges : cell.text;
161
+ // Badges belong to the visible label, so a badged text cell exports that composed label rather than a raw/label hybrid.
162
+ // Typed columns keep their scalar, and native rule operands keep the raw value the rule compares; both carry badges in the text only.
163
+ const badgedValue = !!badges && values === "raw" && !relativeLabel && spec.kind === "text" && !ruleOperands.has(spec.id);
164
+ let value = values === "display" || relativeLabel || badgedValue ? text : cell.value;
131
165
  if (format === "xlsx" && values === "raw" && spec.kind === "datetime" && typeof value === "string")
132
166
  value = datetime(value, dateMode, clock);
133
167
  const capturedFormat = pivot && spec.kind === "number" && cell.value !== null ? pivotNumberFormat(cell) : undefined;
@@ -142,9 +176,12 @@ export function prepareCanopyExport(capture, format, options = {}) {
142
176
  if (format === "csv")
143
177
  result.push(value);
144
178
  else {
145
- const exported = new ExportCell(value, { text: cell.text, ...(presentation ? { presentation } : {}), ...(cell.link === undefined ? {} : { link: cell.link }) });
146
- if (relativeLabel)
179
+ const exported = new ExportCell(value, { text, ...(presentation ? { presentation } : {}), ...(cell.link === undefined ? {} : { link: cell.link }) });
180
+ if (relativeLabel || badgedValue)
147
181
  rawIdentities.set(exported, cell.value);
182
+ // A badge-only label is all suffix: later passes then see the captured label as empty.
183
+ if (badges)
184
+ badgeSuffixes.set(exported, cell.text ? badgeSeparator + badges : badges);
148
185
  result.push(exported);
149
186
  }
150
187
  }
@@ -156,5 +193,5 @@ export function prepareCanopyExport(capture, format, options = {}) {
156
193
  if (rowCount !== null && count !== rowCount)
157
194
  throw new TypeError("Canopy capture did not produce its declared recordCount.");
158
195
  } });
159
- return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot });
196
+ return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot, ruleOperands });
160
197
  }
@@ -0,0 +1,10 @@
1
+ import type { CellPresentation } from "../../core/index.js";
2
+ /** Stable document palette for CanopyX's standard tones. Browser CSS variables and resolved cell.format are never interpreted.
3
+ * Each foreground keeps at least a 4.5:1 contrast ratio on its background. */
4
+ export declare const canopyTonePalette: Readonly<Record<string, {
5
+ readonly color: string;
6
+ readonly background?: string;
7
+ readonly foreground: string;
8
+ }>>;
9
+ /** Default cell presentation for a standard tone; `neutral` and unknown tones have none. */
10
+ export declare const canopyDefaultTones: ReadonlyMap<string, Readonly<CellPresentation>>;
@@ -0,0 +1,12 @@
1
+ /** Stable document palette for CanopyX's standard tones. Browser CSS variables and resolved cell.format are never interpreted.
2
+ * Each foreground keeps at least a 4.5:1 contrast ratio on its background. */
3
+ export const canopyTonePalette = Object.freeze({
4
+ info: Object.freeze({ color: "4472C4", background: "DDEBF7", foreground: "1F4E78" }),
5
+ success: Object.freeze({ color: "70AD47", background: "E2F0D9", foreground: "375623" }),
6
+ warning: Object.freeze({ color: "FFC000", background: "FFF2CC", foreground: "7F5000" }),
7
+ danger: Object.freeze({ color: "C00000", background: "FFC7CE", foreground: "9C0006" }),
8
+ // Muted tones dim the text rather than painting the cell.
9
+ muted: Object.freeze({ color: "A6A6A6", foreground: "595959" })
10
+ });
11
+ /** Default cell presentation for a standard tone; `neutral` and unknown tones have none. */
12
+ export const canopyDefaultTones = new Map(Object.entries(canopyTonePalette).map(([name, tone]) => [name, Object.freeze({ ...(tone.background === undefined ? {} : { background: tone.background }), color: tone.foreground })]));
@@ -12,6 +12,12 @@ export interface CanopyExportCell {
12
12
  /** Native format; optional for mode=value, whose unformatted integer values stay whole in PDF. */
13
13
  readonly numberFormat?: string;
14
14
  readonly tone?: string;
15
+ /** Badge labels drawn beside the cell. Exports append them to the text, for example `Alice · Disabled · Stale`. */
16
+ readonly badges?: readonly (string | {
17
+ readonly text: string;
18
+ readonly tone?: string;
19
+ readonly title?: string;
20
+ })[];
15
21
  readonly link?: ExportLink;
16
22
  readonly diagnostics?: readonly string[];
17
23
  }
@@ -150,7 +156,8 @@ export interface CanopyCapture {
150
156
  readonly presentation: "text" | "semantic";
151
157
  readonly timeZone: "utc" | "local";
152
158
  readonly revision: string;
153
- readonly scope?: "filtered" | "selected" | "all";
159
+ /** `visible` is the rows a tree shows, with collapsed branches left out. */
160
+ readonly scope?: "filtered" | "visible" | "selected" | "all";
154
161
  readonly total?: number | null;
155
162
  readonly matched?: number | null;
156
163
  readonly selection?: readonly string[];
@@ -174,7 +181,8 @@ export interface CanopyDiagnostic {
174
181
  readonly columnId?: string;
175
182
  }
176
183
  export interface CanopySourceOptions {
177
- /** Map semantic tones explicitly; canonical neutral defaults to no override. Cell tone overrides row tone. */
184
+ /** Override semantic tone presentation. info, success, warning, danger and muted default to the document palette;
185
+ * neutral defaults to no override. An entry here replaces that tone's default. Cell tone overrides row tone. */
178
186
  readonly tones?: Readonly<Record<string, CellPresentation>>;
179
187
  /** Selected-column overrides. Unselected IDs are ignored. Native format overrides remain literal Excel syntax. */
180
188
  readonly columnOptions?: Readonly<Record<string, Omit<Partial<ColumnSettings>, "header" | "type">>>;
@@ -2,7 +2,7 @@ import { captureFields } from "../internal/capture.js";
2
2
  /** @internal The workbook owner captures these settings before validation or adapter merging. */
3
3
  export const workbookOptionFields = ["signal", "onProgress", "limits", "sink", "dateMode", "compression", "invalidCharacterPolicy", "appProperties", "cellValueWriters", "oversizedText", "creator", "title", "subject", "description", "created", "modified"];
4
4
  /** @internal Worksheet settings also used by the portable sheet owner. */
5
- export const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
5
+ export const sheetOptionFields = ["columns", "includeHeader", "headerRows", "freezeHeader", "autoFilter", "boldHeader", "headerFill", "headerBorder", "headerWrap", "headerStyle", "alternatingRowStyle", "rowStyle", "cellStyle", "rowOutline", "maxOutlineLevel", "outlineSummaryBelow", "outlineSummaryRight", "columnOutlines", "rowHeight", "headerHeight", "defaultColumnWidth", "freezeColumns", "table", "autoSize", "footer", "print", "title", "mergedCells", "hyperlinks", "conditionalFormats", "dataValidation"];
6
6
  /** @internal Includes inherited format-specific ceilings before a wrapper combines stream settings. */
7
7
  export const workbookLimitFields = ["maxRows", "maxCells", "maxTextCharacters", "maxOutputBytes", "maxStyles", "maxSheets", "maxOverflowCharacters", "maxHyperlinks", "maxImageBytes", "maxBufferedCells", "maxBufferedCharacters", "maxMergedRanges", "maxConditionalFormats", "maxDifferentialStyles", "maxCharts", "maxChartPoints", "maxChartTextCharacters", "maxFormulaCharacters", "maxDataValidations", "maxValidationTextCharacters"];
8
8
  /** @internal Capture the workbook's known ceilings without dropping supported prototype fields. */
@@ -16,7 +16,7 @@ function value(result) {
16
16
  export function portableSheet(options = {}) {
17
17
  options = captureFields(options, sheetOptionFields);
18
18
  if (options.headerStyle !== undefined)
19
- throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader and headerFill.");
19
+ throw new TypeError("Workbook-local header styles require the advanced Workbook API; use boldHeader, headerFill, headerBorder and headerWrap.");
20
20
  style(options.alternatingRowStyle);
21
21
  style(options.title?.style);
22
22
  style(options.footer?.style);