@evotecit/officeimo 0.1.19 → 0.1.43

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 (102) hide show
  1. package/README.md +44 -10
  2. package/bundles/officeimo-canopyx-adapter.js +147 -65
  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 +134 -53
  6. package/bundles/officeimo-canopyx.js +554 -234
  7. package/bundles/officeimo-canopyx.min.js +1 -1
  8. package/bundles/officeimo-canopyx.min.mjs +1 -1
  9. package/bundles/officeimo-canopyx.mjs +477 -158
  10. package/bundles/officeimo-chartforgex-adapter.js +1924 -0
  11. package/bundles/officeimo-chartforgex-adapter.min.js +2 -0
  12. package/bundles/officeimo-chartforgex-adapter.min.mjs +2 -0
  13. package/bundles/officeimo-chartforgex-adapter.mjs +1910 -0
  14. package/bundles/officeimo-chartforgex.js +13594 -0
  15. package/bundles/officeimo-chartforgex.min.js +2 -0
  16. package/bundles/officeimo-chartforgex.min.mjs +2 -0
  17. package/bundles/officeimo-chartforgex.mjs +13487 -0
  18. package/bundles/officeimo-csv.js +12 -7
  19. package/bundles/officeimo-csv.min.js +1 -1
  20. package/bundles/officeimo-csv.min.mjs +1 -1
  21. package/bundles/officeimo-csv.mjs +8 -3
  22. package/bundles/officeimo-datatables-adapter.js +11 -11
  23. package/bundles/officeimo-datatables-adapter.min.js +1 -1
  24. package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
  25. package/bundles/officeimo-datatables-adapter.mjs +7 -7
  26. package/bundles/officeimo-datatables.js +418 -180
  27. package/bundles/officeimo-datatables.min.js +1 -1
  28. package/bundles/officeimo-datatables.min.mjs +1 -1
  29. package/bundles/officeimo-datatables.mjs +350 -112
  30. package/bundles/officeimo-execution.js +14 -9
  31. package/bundles/officeimo-execution.min.js +1 -1
  32. package/bundles/officeimo-execution.min.mjs +1 -1
  33. package/bundles/officeimo-execution.mjs +8 -3
  34. package/bundles/officeimo-pdf.js +286 -120
  35. package/bundles/officeimo-pdf.min.js +1 -1
  36. package/bundles/officeimo-pdf.min.mjs +1 -1
  37. package/bundles/officeimo-pdf.mjs +244 -78
  38. package/bundles/officeimo-xlsx.js +136 -59
  39. package/bundles/officeimo-xlsx.min.js +1 -1
  40. package/bundles/officeimo-xlsx.min.mjs +1 -1
  41. package/bundles/officeimo-xlsx.mjs +114 -37
  42. package/bundles/officeimo.js +416 -178
  43. package/bundles/officeimo.min.js +1 -1
  44. package/bundles/officeimo.min.mjs +1 -1
  45. package/bundles/officeimo.mjs +351 -113
  46. package/dist/core/progress.js +7 -2
  47. package/dist/index.d.ts +1 -1
  48. package/dist/integrations/canopyx/index.js +13 -4
  49. package/dist/integrations/canopyx/pdf-number.js +9 -6
  50. package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
  51. package/dist/integrations/canopyx/rule-predicates.js +2 -1
  52. package/dist/integrations/canopyx/rules.d.ts +1 -1
  53. package/dist/integrations/canopyx/rules.js +11 -13
  54. package/dist/integrations/canopyx/source.js +57 -7
  55. package/dist/integrations/canopyx/tones.d.ts +10 -0
  56. package/dist/integrations/canopyx/tones.js +12 -0
  57. package/dist/integrations/canopyx/types.d.ts +8 -1
  58. package/dist/integrations/chartforgex/capture.d.ts +31 -0
  59. package/dist/integrations/chartforgex/capture.js +103 -0
  60. package/dist/integrations/chartforgex/index.d.ts +13 -0
  61. package/dist/integrations/chartforgex/index.js +88 -0
  62. package/dist/integrations/chartforgex/svg-drawing.d.ts +5 -0
  63. package/dist/integrations/chartforgex/svg-drawing.js +775 -0
  64. package/dist/integrations/chartforgex/svg-geometry.d.ts +23 -0
  65. package/dist/integrations/chartforgex/svg-geometry.js +304 -0
  66. package/dist/integrations/chartforgex/svg-image.d.ts +9 -0
  67. package/dist/integrations/chartforgex/svg-image.js +46 -0
  68. package/dist/integrations/chartforgex/svg-markup.d.ts +10 -0
  69. package/dist/integrations/chartforgex/svg-markup.js +124 -0
  70. package/dist/integrations/chartforgex/svg-paint.d.ts +16 -0
  71. package/dist/integrations/chartforgex/svg-paint.js +146 -0
  72. package/dist/integrations/chartforgex/types.d.ts +77 -0
  73. package/dist/integrations/chartforgex/types.js +1 -0
  74. package/dist/integrations/chartforgex/winansi.d.ts +4 -0
  75. package/dist/integrations/chartforgex/winansi.js +48 -0
  76. package/dist/integrations/chartforgex/workbook.d.ts +12 -0
  77. package/dist/integrations/chartforgex/workbook.js +137 -0
  78. package/dist/pdf/document-drawings.d.ts +1 -1
  79. package/dist/pdf/document-drawings.js +91 -17
  80. package/dist/pdf/document-images.d.ts +7 -1
  81. package/dist/pdf/document-images.js +59 -24
  82. package/dist/pdf/document-types.d.ts +3 -1
  83. package/dist/pdf/document.d.ts +2 -2
  84. package/dist/pdf/document.js +3 -1
  85. package/dist/pdf/drawing-types.d.ts +37 -10
  86. package/dist/pdf/font-resources.d.ts +1 -1
  87. package/dist/pdf/font-resources.js +6 -3
  88. package/dist/pdf/index.d.ts +1 -1
  89. package/dist/pdf/pages.js +15 -0
  90. package/dist/pdf/png.d.ts +11 -2
  91. package/dist/pdf/png.js +50 -23
  92. package/dist/pdf/session.js +3 -2
  93. package/dist/pdf/settings.d.ts +2 -2
  94. package/dist/pdf/settings.js +7 -3
  95. package/dist/xlsx/options.js +2 -2
  96. package/dist/xlsx/portable.js +1 -1
  97. package/dist/xlsx/styles.js +28 -18
  98. package/dist/xlsx/types.d.ts +13 -1
  99. package/dist/xlsx/workbook.js +9 -1
  100. package/dist/xlsx/worksheet.d.ts +13 -1
  101. package/dist/xlsx/worksheet.js +65 -11
  102. package/package.json +9 -2
@@ -6,15 +6,15 @@ const cacheKey = Symbol.for("@evotecit/officeimo/modules");
6
6
  const _modules = officeimo[cacheKey];
7
7
  const _core = key => { const value = _modules && _modules.get(key); if (!value) throw new Error("officeimo-canopyx-adapter.js needs officeimo.js or officeimo.min.js from the same OfficeIMO build, loaded first."); return value; };
8
8
  const _c0 = _core("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00");
9
- const _c1 = _core("6cfd3e806439f6301003a2d1699a74fdfa574d935550ab62b97b528728eaee1f");
9
+ const _c1 = _core("4eea31c4336d3c43bc743739843a3ef31803d8f0ed553f5645ee9de2554eb244");
10
10
  const _c2 = _core("50b3c10b690ceff693c8c5f809195ba6845b20e60f408e791a750d2ecbd5c669");
11
11
  const _c3 = _core("42faf379960e5674a6fdfa8c8fca0bb68bbd74587231248d2524d7004def3671");
12
12
  const _c4 = _core("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208");
13
- const _c5 = _core("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38");
14
- const _c6 = _core("477ff98f49343b8ec4213008254b57a60dd42d07cb9843b3791d5e5f8e295865");
15
- const _c7 = _core("d6587a933b36ccfdba9a2a252389924ac8461f672b3a500082cceb5e53c8b0b6");
16
- const _c8 = _core("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4");
17
- const _c9 = _core("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe");
13
+ const _c5 = _core("6c92204b587bb12cfa85c60eb1fd921804dfa51304538c7be3353e2927551b02");
14
+ const _c6 = _core("fd70ccda89f27c6b874c8840ac944b3ec723dbdef3dfe7600f7bdb81f4660c96");
15
+ const _c7 = _core("edf1bf5cb6d749de0e6823397df6610a6c1cc88768898c1b4d7083ee96ef6759");
16
+ const _c8 = _core("406ac6c93ee68eae70c6f52a1e6f4c56b84f43cae12576040c766dcc5598a580");
17
+ const _c9 = _core("344fd55ffe1a37b32a8eb6a2bdaa14dff90e0fee0f37282457f9e4c3b7bce1ca");
18
18
  const _c10 = _core("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc");
19
19
  const _c11 = _core("732224f6995c2478cf33a6ed01f3e3d3dcccb159a731d6db9280104bd5040fc5");
20
20
  const _c12 = _core("e88a83ca79cd099fc2de29689554c913c7d04b17018098f81c43044064fcdfb8");
@@ -22,11 +22,11 @@ const _c13 = _core("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a
22
22
  const _c14 = _core("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3");
23
23
  const _c15 = _core("c9fde2c438e186da56f740105fcd41c265fdfdd855a4f1b811d556a02387479b");
24
24
  const _c16 = _core("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585");
25
- const _c17 = _core("a10003e971cd5ec2cee127bc9b029a0aa06fe3d50112838929d7a04a55e177c0");
25
+ const _c17 = _core("d6884428c3e4d15a691ecf2523372a03b32de22a890edfbfc9961f2dc92711c2");
26
26
  const _c18 = _core("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b");
27
27
  const _c19 = _core("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596");
28
28
  const _c20 = _core("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070");
29
- const _m4 = _modules.get("7b12a415e92cc9ef7212fb3a88007cb6dc37f9f30077165d4897cfa8052f9a3c") ?? (() => {
29
+ const _m4 = _modules.get("2ab57874b786ef4d2b4841b9072fedd27d40c308f72c6548962810139359deb9") ?? (() => {
30
30
  const { captureFields } = _c2;
31
31
 
32
32
  const { ExportBudget } = _c3;
@@ -67,7 +67,7 @@ function capturePdfOptions(input = {}) {
67
67
  return { ...options, ...(options.limits === undefined ? {} : { limits: capturePdfLimits(options.limits) }) };
68
68
  }
69
69
  const _exports = Object.freeze({ captureCommonLimits: captureCommonLimits, mergeAdapterLimits: mergeAdapterLimits, captureXlsxOptions: captureXlsxOptions, captureCsvOptions: captureCsvOptions, capturePdfOptions: capturePdfOptions });
70
- _modules.set("7b12a415e92cc9ef7212fb3a88007cb6dc37f9f30077165d4897cfa8052f9a3c", _exports);
70
+ _modules.set("2ab57874b786ef4d2b4841b9072fedd27d40c308f72c6548962810139359deb9", _exports);
71
71
  return _exports;
72
72
  })();
73
73
 
@@ -257,7 +257,25 @@ _modules.set("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d",
257
257
  return _exports;
258
258
  })();
259
259
 
260
- const _m13 = _modules.get("40e200b77947621ffacdfa2e1326760a78a52a7dfb6d0cbaa7c7a71607b119a2") ?? (() => {
260
+ const _m19 = _modules.get("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac") ?? (() => {
261
+ /** Stable document palette for CanopyX's standard tones. Browser CSS variables and resolved cell.format are never interpreted.
262
+ * Each foreground keeps at least a 4.5:1 contrast ratio on its background. */
263
+ const canopyTonePalette = Object.freeze({
264
+ info: Object.freeze({ color: "4472C4", background: "DDEBF7", foreground: "1F4E78" }),
265
+ success: Object.freeze({ color: "70AD47", background: "E2F0D9", foreground: "375623" }),
266
+ warning: Object.freeze({ color: "FFC000", background: "FFF2CC", foreground: "7F5000" }),
267
+ danger: Object.freeze({ color: "C00000", background: "FFC7CE", foreground: "9C0006" }),
268
+ // Muted tones dim the text rather than painting the cell.
269
+ muted: Object.freeze({ color: "A6A6A6", foreground: "595959" })
270
+ });
271
+ /** Default cell presentation for a standard tone; `neutral` and unknown tones have none. */
272
+ const canopyDefaultTones = new Map(Object.entries(canopyTonePalette).map(([name, tone]) => [name, Object.freeze({ ...(tone.background === undefined ? {} : { background: tone.background }), color: tone.foreground })]));
273
+ const _exports = Object.freeze({ canopyTonePalette: canopyTonePalette, canopyDefaultTones: canopyDefaultTones });
274
+ _modules.set("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac", _exports);
275
+ return _exports;
276
+ })();
277
+
278
+ const _m13 = _modules.get("0e36f96a408d499b21fb3e84433a016befbb873883a9da15eb4505c40aba3ba7") ?? (() => {
261
279
  const { ExportCell, checkAbort, inputRows } = _c0;
262
280
 
263
281
  const { canopyPivot, pivotNumberFormat } = _m14;
@@ -274,8 +292,21 @@ const { canopyDiagnostics } = _m12;
274
292
 
275
293
  const { canopyNumberFormat, canopyXlsxWidth } = _m18;
276
294
 
295
+ const { canopyDefaultTones } = _m19;
296
+
277
297
  const columnFields = ["width", "format", "wrapText", "alignment", "rowHeader", "groups"];
298
+ // Captured presentations whose cell text already carries the readable content (badge labels are appended below).
299
+ // Their visual loss is reported, never treated as an unsupported export.
300
+ const textFallbacks = new Set(["relative-link", "history-series", "badges", "custom-class", "custom-renderer"]);
301
+ const badgeSeparator = " \u00b7 ";
278
302
  const rawIdentities = new WeakMap();
303
+ // Appended badge labels, kept apart so later passes that re-render a cell's text (PDF numbers) can carry them over.
304
+ const badgeSuffixes = new WeakMap();
305
+ /** @internal The text a later pass may re-render, and the badge suffix it must append back unchanged. */
306
+ function canopyBadgeSplit(cell) {
307
+ const suffix = badgeSuffixes.get(cell), text = cell.text ?? "";
308
+ return suffix !== undefined && text.endsWith(suffix) ? { text: text.slice(0, text.length - suffix.length), suffix } : { text, suffix: "" };
309
+ }
279
310
  /** @internal Grouping uses captured identity even when a detail cell displays a relative-link label. */
280
311
  function canopyIdentityValue(value) {
281
312
  if (!(value instanceof ExportCell))
@@ -283,6 +314,30 @@ function canopyIdentityValue(value) {
283
314
  const original = rawIdentities.get(value);
284
315
  return original === undefined ? value.value : original;
285
316
  }
317
+ // Grids accept any number of badges. Exports keep the first labels that stay readable and fit an Excel text cell,
318
+ // and report how many were left out instead of failing the whole document.
319
+ const maximumBadges = 64, maximumCellText = 32767;
320
+ function badgeText(input, text) {
321
+ if (!Array.isArray(input))
322
+ throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");
323
+ let labels = "", kept = 0, dropped = 0;
324
+ for (const badge of input) {
325
+ const value = typeof badge === "string" ? badge : badge && typeof badge === "object" ? badge.text : undefined;
326
+ if (typeof value !== "string")
327
+ throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");
328
+ const label = value.trim();
329
+ if (!label)
330
+ continue;
331
+ const next = labels ? labels + badgeSeparator + label : label;
332
+ if (kept >= maximumBadges || (text ? text.length + badgeSeparator.length : 0) + next.length > maximumCellText) {
333
+ dropped++;
334
+ continue;
335
+ }
336
+ labels = next;
337
+ kept++;
338
+ }
339
+ return { labels: labels || undefined, dropped };
340
+ }
286
341
  /** Map an immutable CanopyX record capture to a writer without querying the grid or retaining its body. */
287
342
  function createCanopyExport(capture, format, options = {}) {
288
343
  return prepareCanopyExport(capture, format, options).source;
@@ -316,7 +371,7 @@ function prepareCanopyExport(capture, format, options = {}) {
316
371
  throw new TypeError("Canopy presentation diagnostics must be strings.");
317
372
  for (const code of items) {
318
373
  const diagnostic = { code, ...(rowId === undefined ? {} : { rowId }), ...(columnId === undefined ? {} : { columnId }) };
319
- (code === "relative-link" || code === "history-series" ? fallback : report)(diagnostic);
374
+ (textFallbacks.has(code) ? fallback : report)(diagnostic);
320
375
  }
321
376
  };
322
377
  if (request.presentation !== "text" && request.presentation !== "semantic")
@@ -331,11 +386,13 @@ function prepareCanopyExport(capture, format, options = {}) {
331
386
  return undefined;
332
387
  if (typeof name !== "string")
333
388
  throw new TypeError("Canopy tones must be strings.");
334
- const style = tones.get(name);
389
+ const style = tones.get(name) ?? canopyDefaultTones.get(name);
335
390
  if (!style && name !== "neutral")
336
391
  fallback({ code: "UNMAPPED_TONE:" + name, rowId, ...(columnId === undefined ? {} : { columnId }) });
337
392
  return style;
338
393
  };
394
+ // The full writer fills this with columns read by the native rules it emits, before any row is enumerated.
395
+ const ruleOperands = new Set();
339
396
  const ids = new Set();
340
397
  const specs = (pivot?.columns ?? request.columns).map(input => {
341
398
  const fields = captureFields(input, ["id", "title", "kind", "width", "pinned", "format", "wrap", "alignment", "diagnostics"]);
@@ -394,8 +451,17 @@ function prepareCanopyExport(capture, format, options = {}) {
394
451
  diagnostics(cell.diagnostics, row.id, spec.id);
395
452
  // A relative destination is navigation metadata, not the visible label.
396
453
  // History captures already carry their frozen latest scalar (or null).
397
- const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link");
398
- let value = values === "display" || relativeLabel ? cell.text : cell.value;
454
+ // Columns read by an emitted native rule keep the raw scalar the rule compares, so the label goes to the text only.
455
+ const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link") && !ruleOperands.has(spec.id);
456
+ const badged = cell.badges === undefined ? undefined : badgeText(cell.badges, cell.text), badges = badged?.labels;
457
+ if (badged?.dropped)
458
+ fallback({ code: "BADGES_TRUNCATED:" + badged.dropped, rowId: row.id, columnId: spec.id });
459
+ const text = badges ? cell.text ? cell.text + badgeSeparator + badges : badges : cell.text;
460
+ // Badges belong to the visible label, so a badged text cell exports that composed label rather than a raw/label hybrid.
461
+ // Typed columns keep their scalar, and native rule operands keep the raw value the rule compares; both carry badges in the text only.
462
+ // A cell whose badges were all left out still exports its captured label, as it would with the badges.
463
+ const badgedValue = (!!badges || !!badged?.dropped) && values === "raw" && !relativeLabel && spec.kind === "text" && !ruleOperands.has(spec.id);
464
+ let value = values === "display" || relativeLabel || badgedValue ? text : cell.value;
399
465
  if (format === "xlsx" && values === "raw" && spec.kind === "datetime" && typeof value === "string")
400
466
  value = datetime(value, dateMode, clock);
401
467
  const capturedFormat = pivot && spec.kind === "number" && cell.value !== null ? pivotNumberFormat(cell) : undefined;
@@ -410,9 +476,12 @@ function prepareCanopyExport(capture, format, options = {}) {
410
476
  if (format === "csv")
411
477
  result.push(value);
412
478
  else {
413
- const exported = new ExportCell(value, { text: cell.text, ...(presentation ? { presentation } : {}), ...(cell.link === undefined ? {} : { link: cell.link }) });
414
- if (relativeLabel)
479
+ const exported = new ExportCell(value, { text, ...(presentation ? { presentation } : {}), ...(cell.link === undefined ? {} : { link: cell.link }) });
480
+ if (relativeLabel || badgedValue)
415
481
  rawIdentities.set(exported, cell.value);
482
+ // A badge-only label is all suffix: later passes then see the captured label as empty.
483
+ if (badges)
484
+ badgeSuffixes.set(exported, cell.text ? badgeSeparator + badges : badges);
416
485
  result.push(exported);
417
486
  }
418
487
  }
@@ -424,14 +493,14 @@ function prepareCanopyExport(capture, format, options = {}) {
424
493
  if (rowCount !== null && count !== rowCount)
425
494
  throw new TypeError("Canopy capture did not produce its declared recordCount.");
426
495
  } });
427
- return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot });
496
+ return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot, ruleOperands });
428
497
  }
429
- const _exports = Object.freeze({ canopyIdentityValue: canopyIdentityValue, createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
430
- _modules.set("40e200b77947621ffacdfa2e1326760a78a52a7dfb6d0cbaa7c7a71607b119a2", _exports);
498
+ const _exports = Object.freeze({ canopyBadgeSplit: canopyBadgeSplit, canopyIdentityValue: canopyIdentityValue, createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
499
+ _modules.set("0e36f96a408d499b21fb3e84433a016befbb873883a9da15eb4505c40aba3ba7", _exports);
431
500
  return _exports;
432
501
  })();
433
502
 
434
- const _m20 = _modules.get("2b0b73e8c376d24e6a5b498c0f710966b00de0eff44f474d7b2aece7af64fa96") ?? (() => {
503
+ const _m21 = _modules.get("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c") ?? (() => {
435
504
  const { columnName, excelDate } = _c12;
436
505
 
437
506
  const { captureFields } = _c2;
@@ -439,7 +508,7 @@ const { captureFields } = _c2;
439
508
  const { datetime } = _m15;
440
509
 
441
510
  /** Compile only comparisons whose raw types and native encodings have a faithful bounded mapping. */
442
- function canopyPredicate(request, grouped, options, root, unsupported, cellTypes) {
511
+ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes, operands) {
443
512
  let nodes = 0;
444
513
  const operations = { eq: "=", ne: "<>", gt: ">", ge: ">=", lt: "<", le: "<=" };
445
514
  const numeric = (value) => {
@@ -486,6 +555,7 @@ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes
486
555
  const index = request.columns.findIndex(column => column.id === filter.column);
487
556
  if (index < 0)
488
557
  return unsupported("RULE_COLUMN_NOT_EXPORTED:" + filter.column);
558
+ operands?.add(filter.column);
489
559
  const column = request.columns[index], letter = columnName(index + 1 + (grouped ? 1 : 0));
490
560
  const reference = "INDEX($" + letter + ":$" + letter + ",ROW())", present = "NOT(ISBLANK(" + reference + "))";
491
561
  if (column.kind === "number")
@@ -546,28 +616,23 @@ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes
546
616
  return formula;
547
617
  }
548
618
  const _exports = Object.freeze({ canopyPredicate: canopyPredicate });
549
- _modules.set("2b0b73e8c376d24e6a5b498c0f710966b00de0eff44f474d7b2aece7af64fa96", _exports);
619
+ _modules.set("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c", _exports);
550
620
  return _exports;
551
621
  })();
552
622
 
553
- const _m19 = _modules.get("eb8cf81d2a340cdb41301d59c667cef44f3ad1d6a19f717eb8137257b545115e") ?? (() => {
623
+ const _m20 = _modules.get("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8") ?? (() => {
554
624
  const { captureFields } = _c2;
555
625
 
556
- const { canopyPredicate } = _m20;
626
+ const { canopyPredicate } = _m21;
627
+
628
+ const { canopyDefaultTones, canopyTonePalette: palette } = _m19;
557
629
 
558
- // Stable document palette. Browser CSS variables and resolved cell.format are never interpreted.
559
- const palette = {
560
- info: { color: "4472C4", background: "DDEBF7", foreground: "1F4E78" },
561
- success: { color: "70AD47", background: "E2F0D9", foreground: "375623" },
562
- warning: { color: "FFC000", background: "FFF2CC", foreground: "9C6500" },
563
- danger: { color: "C00000", background: "FFC7CE", foreground: "9C0006" }
564
- };
565
630
  class UnsupportedRule extends Error {
566
631
  }
567
632
  const unsupported = (message) => { throw new UnsupportedRule(message); };
568
633
  /** Compile declarations in source order, then emit native target/aspect priorities.
569
634
  * Data-column selectors let grouped writers exclude generated headings, subtotals and grand totals. */
570
- function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes) {
635
+ function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes, operands) {
571
636
  if (request.formatRules === undefined || format === "csv")
572
637
  return [];
573
638
  if (!Array.isArray(request.formatRules) || request.formatRules.length > 1000)
@@ -606,7 +671,7 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
606
671
  }
607
672
  const priorStops = [];
608
673
  const priorRows = [], priorCells = new Map();
609
- const requiredCells = new Map();
674
+ const requiredCells = new Map(), emittedOperands = new Set();
610
675
  const column = (id) => {
611
676
  const index = columns.findIndex(column => column.id === id);
612
677
  if (index < 0)
@@ -624,8 +689,7 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
624
689
  return value;
625
690
  };
626
691
  const style = (name) => {
627
- const defaults = palette[name];
628
- const mapping = tones.get(name) ?? (defaults ? { background: defaults.background, color: defaults.foreground } : undefined);
692
+ const mapping = tones.get(name) ?? canopyDefaultTones.get(name);
629
693
  if (!mapping)
630
694
  return unsupported("UNMAPPED_RULE_TONE:" + name);
631
695
  if ("alignment" in mapping || "wrapText" in mapping)
@@ -698,8 +762,8 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
698
762
  const range = rule.target === "row" ? { column: columns[0].id, through: columns.at(-1).id } : { column: rule.column };
699
763
  if (rule.column !== undefined)
700
764
  column(rule.column);
701
- const ruleCells = new Map();
702
- const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells);
765
+ const ruleCells = new Map(), ruleOperands = new Set();
766
+ const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells, ruleOperands);
703
767
  const reachable = priorStops.length ? "AND(" + ownPredicate + ",NOT(OR(" + priorStops.join(",") + ")))" : ownPredicate;
704
768
  const previous = rule.target === "row" ? priorRows : priorCells.get(rule.column) ?? [];
705
769
  const formula = previous.length ? "AND(" + reachable + ",NOT(OR(" + previous.join(",") + ")))" : reachable;
@@ -711,6 +775,8 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
711
775
  priorCells.set(rule.column, previous);
712
776
  for (const [column, type] of ruleCells)
713
777
  requiredCells.set(column, type);
778
+ for (const id of ruleOperands)
779
+ emittedOperands.add(id);
714
780
  // A matched declaration still stops the row when an earlier tone on that target already won.
715
781
  if (rule.stopIfTrue)
716
782
  priorStops.push(ownPredicate);
@@ -726,15 +792,18 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
726
792
  }
727
793
  for (const [column, type] of requiredCells)
728
794
  cellTypes?.set(column, type);
795
+ // Only emitted rules read raw cells; a rejected comparison leaves its column free to carry badge labels.
796
+ for (const id of emittedOperands)
797
+ operands?.add(id);
729
798
  // Canopy paints cell visuals/tones over the row tint. Build masks before changing native priority order.
730
799
  return Object.freeze([...visuals, ...cells, ...rows]);
731
800
  }
732
801
  const _exports = Object.freeze({ canopyRules: canopyRules });
733
- _modules.set("eb8cf81d2a340cdb41301d59c667cef44f3ad1d6a19f717eb8137257b545115e", _exports);
802
+ _modules.set("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8", _exports);
734
803
  return _exports;
735
804
  })();
736
805
 
737
- const _m22 = _modules.get("97b7bd3037e8060328387470a7e471b6933f1fa062e9562c7908f8ea9a29044b") ?? (() => {
806
+ const _m23 = _modules.get("c94fd416cd3506a68a309631d8b299fc27e75552449835f011ae9d291367f16a") ?? (() => {
738
807
  const { createGroupedReport } = _c13;
739
808
 
740
809
  const { checkAbort } = _c14;
@@ -940,11 +1009,11 @@ function canopyGrouped(source, request, options, limits, report, format) {
940
1009
  ...(options.signal === undefined ? {} : { signal: options.signal }), ...(sourceLimits === undefined ? {} : { limits: sourceLimits }) });
941
1010
  }
942
1011
  const _exports = Object.freeze({ canopyGrouped: canopyGrouped });
943
- _modules.set("97b7bd3037e8060328387470a7e471b6933f1fa062e9562c7908f8ea9a29044b", _exports);
1012
+ _modules.set("c94fd416cd3506a68a309631d8b299fc27e75552449835f011ae9d291367f16a", _exports);
944
1013
  return _exports;
945
1014
  })();
946
1015
 
947
- const _m26 = _modules.get("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8") ?? (() => {
1016
+ const _m27 = _modules.get("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8") ?? (() => {
948
1017
  const { cellText } = _c12;
949
1018
 
950
1019
  const { cleanXml } = _c16;
@@ -1003,7 +1072,7 @@ _modules.set("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8",
1003
1072
  return _exports;
1004
1073
  })();
1005
1074
 
1006
- const _m28 = _modules.get("ccfefc97a47cc288f2c9a2eed33fff323570e35193cedbd876ebb3e8fb78a42e") ?? (() => {
1075
+ const _m29 = _modules.get("c5008cf665c9e1408fbcd0f1daac214a0d44d3ff5a2a5593c7be4dc2506469d8") ?? (() => {
1007
1076
  const { Workbook, addGroupedXlsx } = _c7;
1008
1077
 
1009
1078
  const { portableWorkbook } = _c17;
@@ -1060,13 +1129,15 @@ async function writeCanopyWorkbook(source, grouped, destination, options, labels
1060
1129
  });
1061
1130
  }
1062
1131
  const _exports = Object.freeze({ writeCanopyWorkbook: writeCanopyWorkbook });
1063
- _modules.set("ccfefc97a47cc288f2c9a2eed33fff323570e35193cedbd876ebb3e8fb78a42e", _exports);
1132
+ _modules.set("c5008cf665c9e1408fbcd0f1daac214a0d44d3ff5a2a5593c7be4dc2506469d8", _exports);
1064
1133
  return _exports;
1065
1134
  })();
1066
1135
 
1067
- const _m34 = _modules.get("a0c020124a53cd7be15e3d53388b8393c981c3abc0f8d4aee76a442a2458457f") ?? (() => {
1136
+ const _m35 = _modules.get("e22371f890c61b2c5f4f1539c53e6e49077f39eed3cbfec0904d989c57f4c48d") ?? (() => {
1068
1137
  const { ExportCell } = _c0;
1069
1138
 
1139
+ const { canopyBadgeSplit } = _m13;
1140
+
1070
1141
  /** Fixed numeric formats affect PDF text, not the frozen numeric value used by other writers. */
1071
1142
  function numericProfile(format) {
1072
1143
  // No declared precision: whole values (including counts) stay whole.
@@ -1114,11 +1185,11 @@ function documentDecimal(sample, columns) {
1114
1185
  const profile = numericProfile(cell.presentation?.numberFormat ?? column.format);
1115
1186
  if (!profile)
1116
1187
  continue;
1117
- const captured = capturedNumber(cell.text ?? "", profile);
1188
+ const label = canopyBadgeSplit(cell).text, captured = capturedNumber(label, profile);
1118
1189
  if (!captured)
1119
1190
  continue;
1120
1191
  // A literal percent label is a culture signal without requesting numeric scaling.
1121
- const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") || (cell.text ?? "").includes("%");
1192
+ const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") || label.includes("%");
1122
1193
  if (percentageSignal !== percent)
1123
1194
  continue;
1124
1195
  const match = /([.,])(\d+)$/.exec(captured.number.trimEnd());
@@ -1145,10 +1216,12 @@ function canopyPdfNumbers(sample, columns) {
1145
1216
  return value;
1146
1217
  const format = value.presentation?.numberFormat ?? columns[index].format;
1147
1218
  let profile = numericProfile(format);
1148
- if (!profile || value.text === "")
1219
+ // Badge labels are not part of the number: format the captured label alone, then append them unchanged.
1220
+ const { text: label, suffix: badges } = canopyBadgeSplit(value);
1221
+ if (!profile || label === "")
1149
1222
  return value;
1150
- const captured = capturedNumber(value.text ?? "", profile);
1151
- if (value.text && !captured)
1223
+ const captured = capturedNumber(label, profile);
1224
+ if (label && !captured)
1152
1225
  return value;
1153
1226
  // Undeclared formats normalize only plain numeric labels; a decoration
1154
1227
  // alone does not declare how the raw value was transformed for display.
@@ -1180,16 +1253,16 @@ function canopyPdfNumbers(sample, columns) {
1180
1253
  let suffix = captured?.suffix || profile.suffix;
1181
1254
  if (profile.percent && !profile.suffix)
1182
1255
  suffix = suffix.replace(/%/g, "");
1183
- return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix,
1256
+ return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix + badges,
1184
1257
  ...(value.presentation ? { presentation: value.presentation } : {}), ...(value.link ? { link: value.link } : {}) });
1185
1258
  });
1186
1259
  }
1187
1260
  const _exports = Object.freeze({ canopyPdfNumbers: canopyPdfNumbers });
1188
- _modules.set("a0c020124a53cd7be15e3d53388b8393c981c3abc0f8d4aee76a442a2458457f", _exports);
1261
+ _modules.set("e22371f890c61b2c5f4f1539c53e6e49077f39eed3cbfec0904d989c57f4c48d", _exports);
1189
1262
  return _exports;
1190
1263
  })();
1191
1264
 
1192
- const _m31 = _modules.get("dab3e04542b3619c5c937162b41068f7cb1c3021b4620987c0fb95d4bd98d8e2") ?? (() => {
1265
+ const _m32 = _modules.get("1be58fa87f0eaff8548ddb4bd19a10ca4b913d22dc17764c6b589091e00a5c49") ?? (() => {
1193
1266
  const { ExportCell, NotSupportedError, OfficeIMOError } = _c0;
1194
1267
 
1195
1268
  const { inputRows, checkAbort, pause, taskYieldDue } = _c14;
@@ -1200,7 +1273,7 @@ const { resolveScalar, selectFont, validateFonts } = _c20;
1200
1273
 
1201
1274
  const { settings } = _c5;
1202
1275
 
1203
- const { canopyPdfNumbers } = _m34;
1276
+ const { canopyPdfNumbers } = _m35;
1204
1277
 
1205
1278
  /** A bounded lookahead is replayed once; no second capture, full-dataset copy or smaller font is needed. */
1206
1279
  async function withCanopyPdfLayout(source, captured, options, write) {
@@ -1294,14 +1367,14 @@ async function withCanopyPdfLayout(source, captured, options, write) {
1294
1367
  }
1295
1368
  }
1296
1369
  const _exports = Object.freeze({ withCanopyPdfLayout: withCanopyPdfLayout });
1297
- _modules.set("dab3e04542b3619c5c937162b41068f7cb1c3021b4620987c0fb95d4bd98d8e2", _exports);
1370
+ _modules.set("1be58fa87f0eaff8548ddb4bd19a10ca4b913d22dc17764c6b589091e00a5c49", _exports);
1298
1371
  return _exports;
1299
1372
  })();
1300
1373
 
1301
- const _m0 = _modules.get("5e3ca0adb71a24d6f5c464db0e63a6bbd2f62d6cba70e4be37afc4518de7d0e3") ?? (() => {
1374
+ const _m0 = _modules.get("3ee33e684b087e413a9a9d38781f252a494e92c57c9bdf7022324580eb1e3b54") ?? (() => {
1302
1375
  const { BlobByteSink, ExportCell } = _c0;
1303
1376
 
1304
- const { notifyProgress } = _c1;
1377
+ const { notifyProgress, notifySynchronously } = _c1;
1305
1378
 
1306
1379
  const { captureFields } = _c2;
1307
1380
 
@@ -1319,15 +1392,15 @@ const { prepareCanopyExport } = _m13;
1319
1392
 
1320
1393
  const { canopyPins } = _m18;
1321
1394
 
1322
- const { canopyRules } = _m19;
1395
+ const { canopyRules } = _m20;
1323
1396
 
1324
- const { canopyGrouped } = _m22;
1397
+ const { canopyGrouped } = _m23;
1325
1398
 
1326
- const { canopyAbout } = _m26;
1399
+ const { canopyAbout } = _m27;
1327
1400
 
1328
- const { writeCanopyWorkbook } = _m28;
1401
+ const { writeCanopyWorkbook } = _m29;
1329
1402
 
1330
- const { withCanopyPdfLayout } = _m31;
1403
+ const { withCanopyPdfLayout } = _m32;
1331
1404
 
1332
1405
 
1333
1406
 
@@ -1335,6 +1408,7 @@ const { withCanopyPdfLayout } = _m31;
1335
1408
 
1336
1409
 
1337
1410
 
1411
+ const canopyHeaderFill = "E7EDF5", canopyHeaderBorder = Object.freeze({ bottom: Object.freeze({ style: "thin", color: "A6B4C8" }) });
1338
1412
  /** Write a captured CanopyX grid to a caller-owned destination; partial bytes remain caller-owned on failure. */
1339
1413
  async function writeCanopyTo(capture, format, destination, options = {}) {
1340
1414
  const selected = captureFields(options, ["tones", "columnOptions", "unsupportedPresentation", "datetime", "xlsx", "csv", "pdf", "signal", "onDiagnostic", "limits", "onProgress", "grouped", "about"]);
@@ -1374,17 +1448,25 @@ async function writeCanopyTo(capture, format, destination, options = {}) {
1374
1448
  const stream = { ...(signal ? { signal } : {}), ...progress };
1375
1449
  if (format === "xlsx") {
1376
1450
  const formatLimits = mergeAdapterLimits(xlsx.limits, limits), grouped = pivot ? undefined : canopyGrouped(source, request, { ...selected, xlsx }, formatLimits, report, format);
1377
- const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes);
1451
+ const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes, prepared.ruleOperands);
1378
1452
  if (pivot && (xlsx.sheet?.rowOutline !== undefined || xlsx.sheet?.columnOutlines !== undefined || xlsx.sheet?.maxOutlineLevel !== undefined ||
1379
1453
  xlsx.sheet?.outlineSummaryBelow !== undefined || xlsx.sheet?.outlineSummaryRight !== undefined || xlsx.sheet?.table !== undefined || xlsx.sheet?.footer !== undefined))
1380
1454
  throw new TypeError("Captured pivot metadata owns outlines and totals; worksheet overrides cannot regroup or recalculate it.");
1381
1455
  if (pivot && xlsx.cellValueWriters !== undefined)
1382
1456
  throw new TypeError("Captured pivot exports use frozen values rather than custom cellValueWriters.");
1383
- const sheet = { ...xlsx.sheet, ...(pivot?.sheet ?? {}), ...(pivot ? { autoFilter: false } : {}),
1457
+ // The header matches the PDF table heading: shaded, bold, wrapped and ruled off from the data.
1458
+ const sheet = { headerFill: canopyHeaderFill, headerBorder: canopyHeaderBorder, headerWrap: true, ...xlsx.sheet, ...(pivot?.sheet ?? {}), ...(pivot ? { autoFilter: false } : {}),
1384
1459
  freezeHeader: xlsx.sheet?.freezeHeader ?? (xlsx.sheet?.includeHeader !== false),
1385
1460
  freezeColumns: xlsx.sheet?.freezeColumns ?? (pinned ? pinned + (grouped ? 1 : 0) : 0),
1386
1461
  conditionalFormats: [...rules, ...(xlsx.sheet?.conditionalFormats ?? [])] };
1387
- const settings = { ...xlsx, ...stream, columns: source.columns, sheet, dateMode: xlsx.dateMode ?? request.timeZone, limits: formatLimits };
1462
+ // Data-cell links past Excel's per-worksheet limit keep their label; the worksheet reserves every link it cannot drop.
1463
+ const linkFallback = canopyDiagnostics(format, { ...selected, unsupportedPresentation: "text" }), onHyperlinkOverflow = xlsx.onHyperlinkOverflow;
1464
+ const settings = { ...xlsx, ...stream, columns: source.columns, sheet, dateMode: xlsx.dateMode ?? request.timeZone, limits: formatLimits,
1465
+ hyperlinkOverflow: xlsx.hyperlinkOverflow ?? "drop",
1466
+ onHyperlinkOverflow: (overflow) => {
1467
+ notifySynchronously("onHyperlinkOverflow", onHyperlinkOverflow, overflow);
1468
+ linkFallback({ code: "LINKS_TRUNCATED:" + overflow.dropped });
1469
+ } };
1388
1470
  if (grouped || about)
1389
1471
  return writeCanopyWorkbook(source, grouped, destination, settings, capturedLabels, about);
1390
1472
  return writeXlsxTo(source.rows(), destination, settings);
@@ -1437,7 +1519,7 @@ async function exportCanopy(capture, format, options = {}) {
1437
1519
  }
1438
1520
  }
1439
1521
  const _exports = Object.freeze({ createCanopyExport: _m13.createCanopyExport, ExportCell: _c11.ExportCell, PdfFont: _c19.PdfFont, writeCanopyTo: writeCanopyTo, exportCanopy: exportCanopy });
1440
- _modules.set("5e3ca0adb71a24d6f5c464db0e63a6bbd2f62d6cba70e4be37afc4518de7d0e3", _exports);
1522
+ _modules.set("3ee33e684b087e413a9a9d38781f252a494e92c57c9bdf7022324580eb1e3b54", _exports);
1441
1523
  return _exports;
1442
1524
  })();
1443
1525
  Object.assign(officeimo, _m0);