@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.
- package/README.md +44 -10
- package/bundles/officeimo-canopyx-adapter.js +147 -65
- package/bundles/officeimo-canopyx-adapter.min.js +1 -1
- package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
- package/bundles/officeimo-canopyx-adapter.mjs +134 -53
- package/bundles/officeimo-canopyx.js +554 -234
- package/bundles/officeimo-canopyx.min.js +1 -1
- package/bundles/officeimo-canopyx.min.mjs +1 -1
- package/bundles/officeimo-canopyx.mjs +477 -158
- package/bundles/officeimo-chartforgex-adapter.js +1924 -0
- package/bundles/officeimo-chartforgex-adapter.min.js +2 -0
- package/bundles/officeimo-chartforgex-adapter.min.mjs +2 -0
- package/bundles/officeimo-chartforgex-adapter.mjs +1910 -0
- package/bundles/officeimo-chartforgex.js +13594 -0
- package/bundles/officeimo-chartforgex.min.js +2 -0
- package/bundles/officeimo-chartforgex.min.mjs +2 -0
- package/bundles/officeimo-chartforgex.mjs +13487 -0
- package/bundles/officeimo-csv.js +12 -7
- package/bundles/officeimo-csv.min.js +1 -1
- package/bundles/officeimo-csv.min.mjs +1 -1
- package/bundles/officeimo-csv.mjs +8 -3
- package/bundles/officeimo-datatables-adapter.js +11 -11
- package/bundles/officeimo-datatables-adapter.min.js +1 -1
- package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
- package/bundles/officeimo-datatables-adapter.mjs +7 -7
- package/bundles/officeimo-datatables.js +418 -180
- package/bundles/officeimo-datatables.min.js +1 -1
- package/bundles/officeimo-datatables.min.mjs +1 -1
- package/bundles/officeimo-datatables.mjs +350 -112
- package/bundles/officeimo-execution.js +14 -9
- package/bundles/officeimo-execution.min.js +1 -1
- package/bundles/officeimo-execution.min.mjs +1 -1
- package/bundles/officeimo-execution.mjs +8 -3
- package/bundles/officeimo-pdf.js +286 -120
- package/bundles/officeimo-pdf.min.js +1 -1
- package/bundles/officeimo-pdf.min.mjs +1 -1
- package/bundles/officeimo-pdf.mjs +244 -78
- package/bundles/officeimo-xlsx.js +136 -59
- package/bundles/officeimo-xlsx.min.js +1 -1
- package/bundles/officeimo-xlsx.min.mjs +1 -1
- package/bundles/officeimo-xlsx.mjs +114 -37
- package/bundles/officeimo.js +416 -178
- package/bundles/officeimo.min.js +1 -1
- package/bundles/officeimo.min.mjs +1 -1
- package/bundles/officeimo.mjs +351 -113
- package/dist/core/progress.js +7 -2
- package/dist/index.d.ts +1 -1
- package/dist/integrations/canopyx/index.js +13 -4
- package/dist/integrations/canopyx/pdf-number.js +9 -6
- package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
- package/dist/integrations/canopyx/rule-predicates.js +2 -1
- package/dist/integrations/canopyx/rules.d.ts +1 -1
- package/dist/integrations/canopyx/rules.js +11 -13
- package/dist/integrations/canopyx/source.js +57 -7
- package/dist/integrations/canopyx/tones.d.ts +10 -0
- package/dist/integrations/canopyx/tones.js +12 -0
- package/dist/integrations/canopyx/types.d.ts +8 -1
- package/dist/integrations/chartforgex/capture.d.ts +31 -0
- package/dist/integrations/chartforgex/capture.js +103 -0
- package/dist/integrations/chartforgex/index.d.ts +13 -0
- package/dist/integrations/chartforgex/index.js +88 -0
- package/dist/integrations/chartforgex/svg-drawing.d.ts +5 -0
- package/dist/integrations/chartforgex/svg-drawing.js +775 -0
- package/dist/integrations/chartforgex/svg-geometry.d.ts +23 -0
- package/dist/integrations/chartforgex/svg-geometry.js +304 -0
- package/dist/integrations/chartforgex/svg-image.d.ts +9 -0
- package/dist/integrations/chartforgex/svg-image.js +46 -0
- package/dist/integrations/chartforgex/svg-markup.d.ts +10 -0
- package/dist/integrations/chartforgex/svg-markup.js +124 -0
- package/dist/integrations/chartforgex/svg-paint.d.ts +16 -0
- package/dist/integrations/chartforgex/svg-paint.js +146 -0
- package/dist/integrations/chartforgex/types.d.ts +77 -0
- package/dist/integrations/chartforgex/types.js +1 -0
- package/dist/integrations/chartforgex/winansi.d.ts +4 -0
- package/dist/integrations/chartforgex/winansi.js +48 -0
- package/dist/integrations/chartforgex/workbook.d.ts +12 -0
- package/dist/integrations/chartforgex/workbook.js +137 -0
- package/dist/pdf/document-drawings.d.ts +1 -1
- package/dist/pdf/document-drawings.js +91 -17
- package/dist/pdf/document-images.d.ts +7 -1
- package/dist/pdf/document-images.js +59 -24
- package/dist/pdf/document-types.d.ts +3 -1
- package/dist/pdf/document.d.ts +2 -2
- package/dist/pdf/document.js +3 -1
- package/dist/pdf/drawing-types.d.ts +37 -10
- package/dist/pdf/font-resources.d.ts +1 -1
- package/dist/pdf/font-resources.js +6 -3
- package/dist/pdf/index.d.ts +1 -1
- package/dist/pdf/pages.js +15 -0
- package/dist/pdf/png.d.ts +11 -2
- package/dist/pdf/png.js +50 -23
- package/dist/pdf/session.js +3 -2
- package/dist/pdf/settings.d.ts +2 -2
- package/dist/pdf/settings.js +7 -3
- package/dist/xlsx/options.js +2 -2
- package/dist/xlsx/portable.js +1 -1
- package/dist/xlsx/styles.js +28 -18
- package/dist/xlsx/types.d.ts +13 -1
- package/dist/xlsx/workbook.js +9 -1
- package/dist/xlsx/worksheet.d.ts +13 -1
- package/dist/xlsx/worksheet.js +65 -11
- package/package.json +9 -2
package/dist/core/progress.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/** @internal Notify synchronously; observe an accidental promise before rejecting its unsupported use. */
|
|
2
2
|
export function notifyProgress(callback, progress) {
|
|
3
|
+
notifySynchronously("onProgress", callback, progress);
|
|
4
|
+
}
|
|
5
|
+
/** @internal Run a host notification that must finish before the export continues. A returned promise is observed,
|
|
6
|
+
* so its rejection is never unhandled, and the export fails instead of reporting success before the callback ends. */
|
|
7
|
+
export function notifySynchronously(name, callback, value) {
|
|
3
8
|
if (!callback)
|
|
4
9
|
return;
|
|
5
|
-
const result = callback(
|
|
10
|
+
const result = callback(value);
|
|
6
11
|
if (result && typeof result.then === "function") {
|
|
7
12
|
void Promise.resolve(result).catch(() => { });
|
|
8
|
-
throw new TypeError("
|
|
13
|
+
throw new TypeError(name + " must be synchronous.");
|
|
9
14
|
}
|
|
10
15
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,6 @@ export type { PdfTextPreflightOptions, PdfTextPreflightResult, PdfTextIssueCode
|
|
|
27
27
|
export type { PdfFontPreparationOptions } from "./pdf/index.js";
|
|
28
28
|
export type { PdfTextDirection, PdfShapingRun, PdfShapedGlyph, PdfShapedRun, PdfShapeLineRequest, PdfTextShaper } from "./pdf/index.js";
|
|
29
29
|
export type { PdfDocumentOptions, PdfDocumentBlock, PdfTableOptions, PdfTableBlock, PdfParagraphBlock, PdfParagraphStyle, PdfCaption, PdfListBlock, PdfListItem, PdfGroupBlock, PdfPageBreakBlock, PdfImageBlock, PdfRawImage, PdfJpegImage, PdfPngImage, PdfVectorBlock, PdfPathCommand, PdfTextRun, PdfText } from "./pdf/index.js";
|
|
30
|
-
export type { PdfDrawing, PdfDrawingBlock, PdfDrawingElement, PdfDrawingPath, PdfDrawingText, PdfDrawingGroup, PdfDrawingClip, PdfDrawingFont } from "./pdf/index.js";
|
|
30
|
+
export type { PdfDrawing, PdfDrawingBlock, PdfDrawingElement, PdfDrawingPath, PdfDrawingText, PdfDrawingImage, PdfDrawingGroup, PdfDrawingClip, PdfDrawingFont } from "./pdf/index.js";
|
|
31
31
|
export type { PdfSectionBlock, PdfBookmark } from "./pdf/section-types.js";
|
|
32
32
|
export type { PdfGroupedTableBlock } from "./pdf/document-types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlobByteSink, ExportCell } from "../../core/index.js";
|
|
2
|
-
import { notifyProgress } from "../../core/progress.js";
|
|
2
|
+
import { notifyProgress, notifySynchronously } from "../../core/progress.js";
|
|
3
3
|
import { captureFields } from "../../internal/capture.js";
|
|
4
4
|
import { captureCommonLimits, captureXlsxOptions, captureCsvOptions, capturePdfOptions, mergeAdapterLimits } from "../options.js";
|
|
5
5
|
import { writeXlsxTo } from "../../xlsx/index.js";
|
|
@@ -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,17 +56,25 @@ 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
|
-
|
|
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 ?? [])] };
|
|
68
|
-
|
|
70
|
+
// Data-cell links past Excel's per-worksheet limit keep their label; the worksheet reserves every link it cannot drop.
|
|
71
|
+
const linkFallback = canopyDiagnostics(format, { ...selected, unsupportedPresentation: "text" }), onHyperlinkOverflow = xlsx.onHyperlinkOverflow;
|
|
72
|
+
const settings = { ...xlsx, ...stream, columns: source.columns, sheet, dateMode: xlsx.dateMode ?? request.timeZone, limits: formatLimits,
|
|
73
|
+
hyperlinkOverflow: xlsx.hyperlinkOverflow ?? "drop",
|
|
74
|
+
onHyperlinkOverflow: (overflow) => {
|
|
75
|
+
notifySynchronously("onHyperlinkOverflow", onHyperlinkOverflow, overflow);
|
|
76
|
+
linkFallback({ code: "LINKS_TRUNCATED:" + overflow.dropped });
|
|
77
|
+
} };
|
|
69
78
|
if (grouped || about)
|
|
70
79
|
return writeCanopyWorkbook(source, grouped, destination, settings, capturedLabels, about);
|
|
71
80
|
return writeXlsxTo(source.rows(), destination, settings);
|
|
@@ -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
|
|
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("%") ||
|
|
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
|
-
|
|
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(
|
|
83
|
-
if (
|
|
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
|
-
|
|
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
|
|
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,30 @@ export function canopyIdentityValue(value) {
|
|
|
15
27
|
const original = rawIdentities.get(value);
|
|
16
28
|
return original === undefined ? value.value : original;
|
|
17
29
|
}
|
|
30
|
+
// Grids accept any number of badges. Exports keep the first labels that stay readable and fit an Excel text cell,
|
|
31
|
+
// and report how many were left out instead of failing the whole document.
|
|
32
|
+
const maximumBadges = 64, maximumCellText = 32767;
|
|
33
|
+
function badgeText(input, text) {
|
|
34
|
+
if (!Array.isArray(input))
|
|
35
|
+
throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");
|
|
36
|
+
let labels = "", kept = 0, dropped = 0;
|
|
37
|
+
for (const badge of input) {
|
|
38
|
+
const value = typeof badge === "string" ? badge : badge && typeof badge === "object" ? badge.text : undefined;
|
|
39
|
+
if (typeof value !== "string")
|
|
40
|
+
throw new TypeError("Canopy cell badges must be an array of { text, tone?, title? }.");
|
|
41
|
+
const label = value.trim();
|
|
42
|
+
if (!label)
|
|
43
|
+
continue;
|
|
44
|
+
const next = labels ? labels + badgeSeparator + label : label;
|
|
45
|
+
if (kept >= maximumBadges || (text ? text.length + badgeSeparator.length : 0) + next.length > maximumCellText) {
|
|
46
|
+
dropped++;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
labels = next;
|
|
50
|
+
kept++;
|
|
51
|
+
}
|
|
52
|
+
return { labels: labels || undefined, dropped };
|
|
53
|
+
}
|
|
18
54
|
/** Map an immutable CanopyX record capture to a writer without querying the grid or retaining its body. */
|
|
19
55
|
export function createCanopyExport(capture, format, options = {}) {
|
|
20
56
|
return prepareCanopyExport(capture, format, options).source;
|
|
@@ -48,7 +84,7 @@ export function prepareCanopyExport(capture, format, options = {}) {
|
|
|
48
84
|
throw new TypeError("Canopy presentation diagnostics must be strings.");
|
|
49
85
|
for (const code of items) {
|
|
50
86
|
const diagnostic = { code, ...(rowId === undefined ? {} : { rowId }), ...(columnId === undefined ? {} : { columnId }) };
|
|
51
|
-
(code
|
|
87
|
+
(textFallbacks.has(code) ? fallback : report)(diagnostic);
|
|
52
88
|
}
|
|
53
89
|
};
|
|
54
90
|
if (request.presentation !== "text" && request.presentation !== "semantic")
|
|
@@ -63,11 +99,13 @@ export function prepareCanopyExport(capture, format, options = {}) {
|
|
|
63
99
|
return undefined;
|
|
64
100
|
if (typeof name !== "string")
|
|
65
101
|
throw new TypeError("Canopy tones must be strings.");
|
|
66
|
-
const style = tones.get(name);
|
|
102
|
+
const style = tones.get(name) ?? canopyDefaultTones.get(name);
|
|
67
103
|
if (!style && name !== "neutral")
|
|
68
104
|
fallback({ code: "UNMAPPED_TONE:" + name, rowId, ...(columnId === undefined ? {} : { columnId }) });
|
|
69
105
|
return style;
|
|
70
106
|
};
|
|
107
|
+
// The full writer fills this with columns read by the native rules it emits, before any row is enumerated.
|
|
108
|
+
const ruleOperands = new Set();
|
|
71
109
|
const ids = new Set();
|
|
72
110
|
const specs = (pivot?.columns ?? request.columns).map(input => {
|
|
73
111
|
const fields = captureFields(input, ["id", "title", "kind", "width", "pinned", "format", "wrap", "alignment", "diagnostics"]);
|
|
@@ -126,8 +164,17 @@ export function prepareCanopyExport(capture, format, options = {}) {
|
|
|
126
164
|
diagnostics(cell.diagnostics, row.id, spec.id);
|
|
127
165
|
// A relative destination is navigation metadata, not the visible label.
|
|
128
166
|
// History captures already carry their frozen latest scalar (or null).
|
|
129
|
-
|
|
130
|
-
|
|
167
|
+
// Columns read by an emitted native rule keep the raw scalar the rule compares, so the label goes to the text only.
|
|
168
|
+
const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link") && !ruleOperands.has(spec.id);
|
|
169
|
+
const badged = cell.badges === undefined ? undefined : badgeText(cell.badges, cell.text), badges = badged?.labels;
|
|
170
|
+
if (badged?.dropped)
|
|
171
|
+
fallback({ code: "BADGES_TRUNCATED:" + badged.dropped, rowId: row.id, columnId: spec.id });
|
|
172
|
+
const text = badges ? cell.text ? cell.text + badgeSeparator + badges : badges : cell.text;
|
|
173
|
+
// Badges belong to the visible label, so a badged text cell exports that composed label rather than a raw/label hybrid.
|
|
174
|
+
// Typed columns keep their scalar, and native rule operands keep the raw value the rule compares; both carry badges in the text only.
|
|
175
|
+
// A cell whose badges were all left out still exports its captured label, as it would with the badges.
|
|
176
|
+
const badgedValue = (!!badges || !!badged?.dropped) && values === "raw" && !relativeLabel && spec.kind === "text" && !ruleOperands.has(spec.id);
|
|
177
|
+
let value = values === "display" || relativeLabel || badgedValue ? text : cell.value;
|
|
131
178
|
if (format === "xlsx" && values === "raw" && spec.kind === "datetime" && typeof value === "string")
|
|
132
179
|
value = datetime(value, dateMode, clock);
|
|
133
180
|
const capturedFormat = pivot && spec.kind === "number" && cell.value !== null ? pivotNumberFormat(cell) : undefined;
|
|
@@ -142,9 +189,12 @@ export function prepareCanopyExport(capture, format, options = {}) {
|
|
|
142
189
|
if (format === "csv")
|
|
143
190
|
result.push(value);
|
|
144
191
|
else {
|
|
145
|
-
const exported = new ExportCell(value, { text
|
|
146
|
-
if (relativeLabel)
|
|
192
|
+
const exported = new ExportCell(value, { text, ...(presentation ? { presentation } : {}), ...(cell.link === undefined ? {} : { link: cell.link }) });
|
|
193
|
+
if (relativeLabel || badgedValue)
|
|
147
194
|
rawIdentities.set(exported, cell.value);
|
|
195
|
+
// A badge-only label is all suffix: later passes then see the captured label as empty.
|
|
196
|
+
if (badges)
|
|
197
|
+
badgeSuffixes.set(exported, cell.text ? badgeSeparator + badges : badges);
|
|
148
198
|
result.push(exported);
|
|
149
199
|
}
|
|
150
200
|
}
|
|
@@ -156,5 +206,5 @@ export function prepareCanopyExport(capture, format, options = {}) {
|
|
|
156
206
|
if (rowCount !== null && count !== rowCount)
|
|
157
207
|
throw new TypeError("Canopy capture did not produce its declared recordCount.");
|
|
158
208
|
} });
|
|
159
|
-
return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot });
|
|
209
|
+
return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot, ruleOperands });
|
|
160
210
|
}
|
|
@@ -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
|
}
|
|
@@ -175,7 +181,8 @@ export interface CanopyDiagnostic {
|
|
|
175
181
|
readonly columnId?: string;
|
|
176
182
|
}
|
|
177
183
|
export interface CanopySourceOptions {
|
|
178
|
-
/**
|
|
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. */
|
|
179
186
|
readonly tones?: Readonly<Record<string, CellPresentation>>;
|
|
180
187
|
/** Selected-column overrides. Unselected IDs are ignored. Native format overrides remain literal Excel syntax. */
|
|
181
188
|
readonly columnOptions?: Readonly<Record<string, Omit<Partial<ColumnSettings>, "header" | "type">>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ChartForgeXCapture } from "./types.js";
|
|
2
|
+
export type ChartXKind = "date" | "number" | "category";
|
|
3
|
+
export interface PreparedPoint {
|
|
4
|
+
readonly x: Date | number | string | null;
|
|
5
|
+
/** Identity of the x value for wide layouts; null when absent. */
|
|
6
|
+
readonly key: number | string | null;
|
|
7
|
+
readonly xCaption: string | undefined;
|
|
8
|
+
readonly y: number | null;
|
|
9
|
+
readonly caption: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface PreparedSeries {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly unit: string | undefined;
|
|
15
|
+
readonly format: string | undefined;
|
|
16
|
+
readonly points: readonly PreparedPoint[];
|
|
17
|
+
}
|
|
18
|
+
export interface PreparedChart {
|
|
19
|
+
readonly title: string | undefined;
|
|
20
|
+
readonly description: string | undefined;
|
|
21
|
+
readonly kind: ChartXKind;
|
|
22
|
+
readonly xTitle: string;
|
|
23
|
+
readonly xFormat: string | undefined;
|
|
24
|
+
readonly yTitle: string;
|
|
25
|
+
readonly yUnit: string | undefined;
|
|
26
|
+
readonly yFormat: string | undefined;
|
|
27
|
+
readonly series: readonly PreparedSeries[];
|
|
28
|
+
readonly svg: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
/** Read the capture once into owned records, so later caller mutation cannot change an export in progress. */
|
|
31
|
+
export declare function prepareChart(input: ChartForgeXCapture, maxPoints?: number): PreparedChart;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { NotSupportedError } from "../../core/errors.js";
|
|
2
|
+
function record(value, name) {
|
|
3
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
4
|
+
throw new TypeError("Chart capture " + name + " must be an object.");
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
function text(value, name, required = false) {
|
|
8
|
+
if (value === undefined || value === null) {
|
|
9
|
+
if (required)
|
|
10
|
+
throw new TypeError("Chart capture " + name + " is required.");
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
if (typeof value !== "string")
|
|
14
|
+
throw new TypeError("Chart capture " + name + " must be a string.");
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
const isoDate = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d{1,9})?)?)?(?:Z|[+-]\d{2}:?\d{2})?$/;
|
|
18
|
+
/** Dates without an offset are UTC wall-clock values, the way ChartForgeX serializes time axes, never the reader's local time. */
|
|
19
|
+
function isoInstant(value) {
|
|
20
|
+
const normalized = value.replace(" ", "T").replace(/([+-]\d{2})(\d{2})$/, "$1:$2").replace(/(\.\d{3})\d+/, "$1");
|
|
21
|
+
return normalized.length === 10 || /(Z|[+-]\d{2}:\d{2})$/.test(normalized) ? normalized : normalized + "Z";
|
|
22
|
+
}
|
|
23
|
+
function parseDate(value) {
|
|
24
|
+
const normalized = value.trim();
|
|
25
|
+
if (!isoDate.test(normalized))
|
|
26
|
+
return NaN;
|
|
27
|
+
const day = normalized.slice(0, 10);
|
|
28
|
+
const midnight = new Date(day + "T00:00:00Z");
|
|
29
|
+
if (!Number.isFinite(midnight.getTime()) || !midnight.toISOString().startsWith(day + "T"))
|
|
30
|
+
return NaN;
|
|
31
|
+
return Date.parse(isoInstant(normalized));
|
|
32
|
+
}
|
|
33
|
+
/** Read the capture once into owned records, so later caller mutation cannot change an export in progress. */
|
|
34
|
+
export function prepareChart(input, maxPoints = 1048575) {
|
|
35
|
+
const capture = record(input, "");
|
|
36
|
+
if (capture.version !== 1)
|
|
37
|
+
throw new NotSupportedError("Only ChartForgeX capture version 1 is supported.");
|
|
38
|
+
const axis = record(capture.x, "x"), kind = axis.kind;
|
|
39
|
+
if (kind !== "date" && kind !== "number" && kind !== "category")
|
|
40
|
+
throw new TypeError("Chart capture x.kind must be date, number or category.");
|
|
41
|
+
const yAxis = capture.y === undefined ? {} : record(capture.y, "y");
|
|
42
|
+
if (!Array.isArray(capture.series))
|
|
43
|
+
throw new TypeError("Chart capture series must be an array.");
|
|
44
|
+
let count = 0;
|
|
45
|
+
const series = Array.from(capture.series, (entry, index) => {
|
|
46
|
+
const value = record(entry, "series[" + index + "]"), points = value.points;
|
|
47
|
+
if (!Array.isArray(points))
|
|
48
|
+
throw new TypeError("Chart capture series[" + index + "].points must be an array.");
|
|
49
|
+
const pointCount = points.length;
|
|
50
|
+
if ((count += pointCount) > maxPoints)
|
|
51
|
+
throw new RangeError("Chart capture has more than " + maxPoints + " points.");
|
|
52
|
+
return {
|
|
53
|
+
id: text(value.id, "series[" + index + "].id", true), name: text(value.name, "series[" + index + "].name", true),
|
|
54
|
+
unit: text(value.unit, "series unit"), format: text(value.format, "series format"),
|
|
55
|
+
points: Array.from({ length: pointCount }, (_, point) => {
|
|
56
|
+
const item = record(points[point], "point"), where = "series[" + index + "].points[" + point + "]";
|
|
57
|
+
const y = item.y;
|
|
58
|
+
if (y !== null && y !== undefined && (typeof y !== "number" || !Number.isFinite(y)))
|
|
59
|
+
throw new TypeError(where + ".y must be a finite number or null.");
|
|
60
|
+
let x = null, key = null;
|
|
61
|
+
const source = item.x;
|
|
62
|
+
if (source !== null && source !== undefined) {
|
|
63
|
+
if (kind === "date") {
|
|
64
|
+
let time = NaN;
|
|
65
|
+
if (typeof source === "string")
|
|
66
|
+
time = parseDate(source);
|
|
67
|
+
if (typeof source === "object") {
|
|
68
|
+
try {
|
|
69
|
+
time = Date.prototype.getTime.call(source);
|
|
70
|
+
}
|
|
71
|
+
catch { /* Not a Date. */ }
|
|
72
|
+
}
|
|
73
|
+
if (!Number.isFinite(time))
|
|
74
|
+
throw new TypeError(where + ".x must be an ISO 8601 date string or a valid Date.");
|
|
75
|
+
x = new Date(time);
|
|
76
|
+
key = time;
|
|
77
|
+
}
|
|
78
|
+
else if (kind === "number") {
|
|
79
|
+
if (typeof source !== "number" || !Number.isFinite(source))
|
|
80
|
+
throw new TypeError(where + ".x must be a finite number.");
|
|
81
|
+
x = key = source;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
if (typeof source !== "string" && typeof source !== "number")
|
|
85
|
+
throw new TypeError(where + ".x must be a category label.");
|
|
86
|
+
x = key = String(source);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return { x, key, xCaption: text(item.xCaption, where + ".xCaption"), y: y ?? null, caption: text(item.caption, where + ".caption") };
|
|
90
|
+
})
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
const svg = capture.svg;
|
|
94
|
+
const markup = svg && typeof svg === "object" ? svg.outerHTML : svg;
|
|
95
|
+
if (svg != null && typeof markup !== "string")
|
|
96
|
+
throw new TypeError("Chart capture svg must be markup or an element.");
|
|
97
|
+
return {
|
|
98
|
+
title: text(capture.title, "title"), description: text(capture.description, "description"), kind,
|
|
99
|
+
xTitle: text(axis.title, "x.title") || "X", xFormat: text(axis.format, "x.format"),
|
|
100
|
+
yTitle: text(yAxis.title, "y.title") || "Value", yUnit: text(yAxis.unit, "y.unit"), yFormat: text(yAxis.format, "y.format"),
|
|
101
|
+
series, svg: typeof markup === "string" ? markup : undefined
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OutputDestination, ExportResult } from "../../core/index.js";
|
|
2
|
+
import type { PdfDrawing } from "../../pdf/index.js";
|
|
3
|
+
import type { ChartForgeXCapture, ChartForgeXFormat, ChartForgeXSvgOptions, ChartForgeXWriteOptions } from "./types.js";
|
|
4
|
+
export { PdfFont } from "../../pdf/font.js";
|
|
5
|
+
export type { ChartForgeXCapture, ChartForgeXSeries, ChartForgeXPoint, ChartForgeXAxis, ChartForgeXFormat, ChartForgeXDiagnostic, ChartForgeXSvgOptions, ChartForgeXWriteOptions } from "./types.js";
|
|
6
|
+
/** Convert chart SVG into a version 2 drawing with embedded image elements. */
|
|
7
|
+
export declare function chartForgeXDrawing(svg: string, version: 2, options?: ChartForgeXSvgOptions): PdfDrawing<2>;
|
|
8
|
+
/** Convert chart SVG into a version 1 drawing without images. */
|
|
9
|
+
export declare function chartForgeXDrawing(svg: string, options?: ChartForgeXSvgOptions): PdfDrawing;
|
|
10
|
+
/** Write a ChartForgeX capture as a typed XLSX sheet of its series, or a PDF with its title, description and vector SVG. */
|
|
11
|
+
export declare function writeChartForgeXTo(capture: ChartForgeXCapture, format: ChartForgeXFormat, destination: OutputDestination, options?: ChartForgeXWriteOptions): Promise<ExportResult>;
|
|
12
|
+
/** Export a ChartForgeX capture as a Blob. No chart runtime, browser layout or server is involved. */
|
|
13
|
+
export declare function exportChartForgeX(capture: ChartForgeXCapture, format: ChartForgeXFormat, options?: ChartForgeXWriteOptions): Promise<Blob>;
|