@json-to-office/core-pptx 0.33.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chart.d.ts +5 -0
- package/dist/components/chart.d.ts.map +1 -1
- package/dist/components/table.d.ts +1 -0
- package/dist/components/table.d.ts.map +1 -1
- package/dist/core/fontResolution.d.ts.map +1 -1
- package/dist/core/generator.d.ts.map +1 -1
- package/dist/core/packagePresentation.d.ts +6 -1
- package/dist/core/packagePresentation.d.ts.map +1 -1
- package/dist/core/svgRasterFallback.d.ts +12 -0
- package/dist/core/svgRasterFallback.d.ts.map +1 -0
- package/dist/index.js +231 -31
- package/dist/index.js.map +1 -1
- package/dist/plugin/createPresentationGenerator.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/warn.d.ts +2 -0
- package/dist/utils/warn.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -22,6 +22,7 @@ interface ChartComponentProps {
|
|
|
22
22
|
titleFontSize?: number;
|
|
23
23
|
titleColor?: string;
|
|
24
24
|
titleFontFace?: string;
|
|
25
|
+
titleFontWeight?: number;
|
|
25
26
|
chartColors?: string[];
|
|
26
27
|
dataBorder?: {
|
|
27
28
|
pt: number;
|
|
@@ -30,6 +31,7 @@ interface ChartComponentProps {
|
|
|
30
31
|
legendPos?: string;
|
|
31
32
|
legendFontSize?: number;
|
|
32
33
|
legendFontFace?: string;
|
|
34
|
+
legendFontWeight?: number;
|
|
33
35
|
legendColor?: string;
|
|
34
36
|
catAxisTitle?: string;
|
|
35
37
|
catAxisHidden?: boolean;
|
|
@@ -37,6 +39,7 @@ interface ChartComponentProps {
|
|
|
37
39
|
catAxisLabelFontSize?: number;
|
|
38
40
|
catAxisLabelColor?: string;
|
|
39
41
|
catAxisLabelFontFace?: string;
|
|
42
|
+
catAxisLabelFontWeight?: number;
|
|
40
43
|
catGridLine?: {
|
|
41
44
|
style?: string;
|
|
42
45
|
size?: number;
|
|
@@ -50,6 +53,7 @@ interface ChartComponentProps {
|
|
|
50
53
|
valAxisMajorUnit?: number;
|
|
51
54
|
valAxisLabelColor?: string;
|
|
52
55
|
valAxisLabelFontFace?: string;
|
|
56
|
+
valAxisLabelFontWeight?: number;
|
|
53
57
|
valAxisLabelFontSize?: number;
|
|
54
58
|
valGridLine?: {
|
|
55
59
|
style?: string;
|
|
@@ -72,6 +76,7 @@ interface ChartComponentProps {
|
|
|
72
76
|
dataLabelColor?: string;
|
|
73
77
|
dataLabelFontSize?: number;
|
|
74
78
|
dataLabelFontFace?: string;
|
|
79
|
+
dataLabelFontWeight?: number;
|
|
75
80
|
dataLabelFontBold?: boolean;
|
|
76
81
|
dataLabelPosition?: string;
|
|
77
82
|
x?: number | string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/components/chart.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/components/chart.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAKjE,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,eAAe,EAAE,CAAC;IAExB,UAAU,CAA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B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,eAAe,EACtB,IAAI,CAAC,EAAE,SAAS,EAChB,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,IAAI,CA+QN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fontResolution.d.ts","sourceRoot":"","sources":["../../src/core/fontResolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"fontResolution.d.ts","sourceRoot":"","sources":["../../src/core/fontResolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAc5E,OAAO,KAAK,EACV,eAAe,EACf,+BAA+B,EAChC,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,+BAA+B,EACzC,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,eAAe,EAAE,EAC3B,KAAK,CAAC,EAAE,eAAe,GACtB,OAAO,CAAC,YAAY,EAAE,CAAC,CAoEzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/core/generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,OAAO,KAAK,EACV,+BAA+B,EAC/B,eAAe,EACf,eAAe,EACf,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,E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AC,CAIf;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,SAAS,EACf,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,4BAA4B,GACrC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;CAQjC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { PendingXmlFill } from '../types';
|
|
2
|
+
import type { PendingXmlFill, PipelineWarning } from '../types';
|
|
3
3
|
/** Stable default shared by package entries and OOXML core metadata. */
|
|
4
4
|
export declare const DEFAULT_GENERATED_AT = "2000-01-01T00:00:00.000Z";
|
|
5
5
|
export interface PresentationPackagingOptions {
|
|
@@ -13,6 +13,11 @@ export interface PresentationPackagingOptions {
|
|
|
13
13
|
* the registered fill XML.
|
|
14
14
|
*/
|
|
15
15
|
pendingFills?: PendingXmlFill[];
|
|
16
|
+
/**
|
|
17
|
+
* Warning sink for post-generation repairs. Only the SVG raster fallback
|
|
18
|
+
* pass reports here; when omitted its failures go to `console.warn`.
|
|
19
|
+
*/
|
|
20
|
+
warnings?: PipelineWarning[];
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* Apply post-generation OOXML fixes and deterministic package metadata.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packagePresentation.d.ts","sourceRoot":"","sources":["../../src/core/packagePresentation.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"packagePresentation.d.ts","sourceRoot":"","sources":["../../src/core/packagePresentation.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAMhE,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAE/D,MAAM,WAAW,4BAA4B;IAC3C,+DAA+D;IAC/D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC5B;;;;OAIG;IACH,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B;AAqLD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,4BAAiC,GACzC,OAAO,CAAC,MAAM,CAAC,CAqCjB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type JSZip from 'jszip';
|
|
2
|
+
import type { PipelineWarning } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Replace the broken-image placeholders PptxGenJS writes for inline SVG
|
|
5
|
+
* pictures with real rasterizations of those SVGs. Never throws: a missing
|
|
6
|
+
* native binding or an SVG resvg rejects degrades to a warning and leaves the
|
|
7
|
+
* package as generated.
|
|
8
|
+
*
|
|
9
|
+
* @returns whether any part of the zip was rewritten.
|
|
10
|
+
*/
|
|
11
|
+
export declare function repairSvgRasterFallbacks(zip: JSZip, warnings?: PipelineWarning[]): Promise<boolean>;
|
|
12
|
+
//# sourceMappingURL=svgRasterFallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgRasterFallback.d.ts","sourceRoot":"","sources":["../../src/core/svgRasterFallback.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAyIhD;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,KAAK,EACV,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,OAAO,CAAC,OAAO,CAAC,CAkElB"}
|
package/dist/index.js
CHANGED
|
@@ -17,9 +17,11 @@ var W = {
|
|
|
17
17
|
CHART_NO_DATA: "CHART_NO_DATA",
|
|
18
18
|
CHART_INVALID_SERIES: "CHART_INVALID_SERIES",
|
|
19
19
|
CHART_MULTI_SERIES: "CHART_MULTI_SERIES",
|
|
20
|
+
CHART_FONT_WEIGHT_DROPPED: "CHART_FONT_WEIGHT_DROPPED",
|
|
20
21
|
IMAGE_NO_SOURCE: "IMAGE_NO_SOURCE",
|
|
21
22
|
IMAGE_PROBE_FAILED: "IMAGE_PROBE_FAILED",
|
|
22
23
|
IMAGE_PATH_OUTSIDE_ROOTS: "IMAGE_PATH_OUTSIDE_ROOTS",
|
|
24
|
+
IMAGE_SVG_RASTER_FAILED: "IMAGE_SVG_RASTER_FAILED",
|
|
23
25
|
MISSING_TEMPLATE: "MISSING_TEMPLATE",
|
|
24
26
|
UNKNOWN_PLACEHOLDER: "UNKNOWN_PLACEHOLDER",
|
|
25
27
|
PLACEHOLDER_NO_POSITION: "PLACEHOLDER_NO_POSITION",
|
|
@@ -1258,9 +1260,9 @@ function renderTableComponent(slide, props, theme, pptx, warnings) {
|
|
|
1258
1260
|
}
|
|
1259
1261
|
if (cell.fontSize) cellOpts.fontSize = cell.fontSize;
|
|
1260
1262
|
if (cell.fontFace) cellOpts.fontFace = cell.fontFace;
|
|
1261
|
-
if (cell.bold) cellOpts.bold =
|
|
1263
|
+
if (cell.bold !== void 0) cellOpts.bold = cell.bold;
|
|
1262
1264
|
if (cell.italic) cellOpts.italic = true;
|
|
1263
|
-
if (cell.fontWeight != null || cell.bold
|
|
1265
|
+
if (cell.fontWeight != null || cell.bold !== void 0) {
|
|
1264
1266
|
const w = applyFontWeight({
|
|
1265
1267
|
family: cellOpts.fontFace ?? props.fontFace ?? theme.fonts.body,
|
|
1266
1268
|
fontWeight: cell.fontWeight,
|
|
@@ -1297,6 +1299,14 @@ function renderTableComponent(slide, props, theme, pptx, warnings) {
|
|
|
1297
1299
|
opts.fill = { color: resolveColor(props.fill, theme, warnings) };
|
|
1298
1300
|
opts.fontSize = props.fontSize ?? theme.defaults.fontSize;
|
|
1299
1301
|
opts.fontFace = props.fontFace ?? theme.fonts.body;
|
|
1302
|
+
if (props.fontWeight != null) {
|
|
1303
|
+
const w = applyFontWeight({
|
|
1304
|
+
family: opts.fontFace,
|
|
1305
|
+
fontWeight: props.fontWeight
|
|
1306
|
+
});
|
|
1307
|
+
if (w.fontFace !== void 0) opts.fontFace = w.fontFace;
|
|
1308
|
+
if (w.bold === true) opts.bold = true;
|
|
1309
|
+
}
|
|
1300
1310
|
if (props.color) opts.color = resolveColor(props.color, theme, warnings);
|
|
1301
1311
|
if (props.align) opts.align = props.align;
|
|
1302
1312
|
opts.valign = props.valign ?? "middle";
|
|
@@ -1539,6 +1549,27 @@ function renderChartComponent(slide, props, theme, _pptx, warnings) {
|
|
|
1539
1549
|
color: resolveColor(props.dataBorder.color, theme, warnings)
|
|
1540
1550
|
};
|
|
1541
1551
|
}
|
|
1552
|
+
const applyLabelFont = (faceKey, boldKey, face, weight) => {
|
|
1553
|
+
if (weight === void 0) {
|
|
1554
|
+
if (face !== void 0) opts[faceKey] = face;
|
|
1555
|
+
return;
|
|
1556
|
+
}
|
|
1557
|
+
const w = applyFontWeight({
|
|
1558
|
+
family: face ?? theme.fonts?.body,
|
|
1559
|
+
fontWeight: weight
|
|
1560
|
+
});
|
|
1561
|
+
if (w.fontFace !== void 0) opts[faceKey] = w.fontFace;
|
|
1562
|
+
if (boldKey !== void 0) {
|
|
1563
|
+
opts[boldKey] = w.bold === true;
|
|
1564
|
+
} else if (w.bold === true) {
|
|
1565
|
+
warn(
|
|
1566
|
+
warnings,
|
|
1567
|
+
W.CHART_FONT_WEIGHT_DROPPED,
|
|
1568
|
+
`Chart ${faceKey} weight ${weight} renders as Regular \u2014 PowerPoint gives the legend no bold toggle, and only non-RIBBI weights resolve to a sub-family face`,
|
|
1569
|
+
{ component: "chart" }
|
|
1570
|
+
);
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1542
1573
|
if (props.showLegend !== void 0) opts.showLegend = props.showLegend;
|
|
1543
1574
|
if (props.showTitle !== void 0) opts.showTitle = props.showTitle;
|
|
1544
1575
|
if (props.showValue !== void 0) opts.showValue = props.showValue;
|
|
@@ -1548,13 +1579,21 @@ function renderChartComponent(slide, props, theme, _pptx, warnings) {
|
|
|
1548
1579
|
if (props.title !== void 0) opts.title = props.title;
|
|
1549
1580
|
if (props.titleFontSize !== void 0)
|
|
1550
1581
|
opts.titleFontSize = props.titleFontSize;
|
|
1551
|
-
|
|
1552
|
-
|
|
1582
|
+
applyLabelFont(
|
|
1583
|
+
"titleFontFace",
|
|
1584
|
+
"titleBold",
|
|
1585
|
+
props.titleFontFace,
|
|
1586
|
+
props.titleFontWeight
|
|
1587
|
+
);
|
|
1553
1588
|
if (props.legendPos !== void 0) opts.legendPos = props.legendPos;
|
|
1554
1589
|
if (props.legendFontSize !== void 0)
|
|
1555
1590
|
opts.legendFontSize = props.legendFontSize;
|
|
1556
|
-
|
|
1557
|
-
|
|
1591
|
+
applyLabelFont(
|
|
1592
|
+
"legendFontFace",
|
|
1593
|
+
void 0,
|
|
1594
|
+
props.legendFontFace,
|
|
1595
|
+
props.legendFontWeight
|
|
1596
|
+
);
|
|
1558
1597
|
if (props.catAxisTitle !== void 0) {
|
|
1559
1598
|
opts.catAxisTitle = props.catAxisTitle;
|
|
1560
1599
|
opts.showCatAxisTitle = true;
|
|
@@ -1565,8 +1604,12 @@ function renderChartComponent(slide, props, theme, _pptx, warnings) {
|
|
|
1565
1604
|
opts.catAxisLabelRotate = props.catAxisLabelRotate;
|
|
1566
1605
|
if (props.catAxisLabelFontSize !== void 0)
|
|
1567
1606
|
opts.catAxisLabelFontSize = props.catAxisLabelFontSize;
|
|
1568
|
-
|
|
1569
|
-
|
|
1607
|
+
applyLabelFont(
|
|
1608
|
+
"catAxisLabelFontFace",
|
|
1609
|
+
"catAxisLabelFontBold",
|
|
1610
|
+
props.catAxisLabelFontFace,
|
|
1611
|
+
props.catAxisLabelFontWeight
|
|
1612
|
+
);
|
|
1570
1613
|
if (props.catGridLine !== void 0)
|
|
1571
1614
|
opts.catGridLine = resolveGridLine(props.catGridLine, theme, warnings);
|
|
1572
1615
|
if (props.valAxisTitle !== void 0) {
|
|
@@ -1583,8 +1626,12 @@ function renderChartComponent(slide, props, theme, _pptx, warnings) {
|
|
|
1583
1626
|
opts.valAxisLabelFormatCode = props.valAxisLabelFormatCode;
|
|
1584
1627
|
if (props.valAxisMajorUnit !== void 0)
|
|
1585
1628
|
opts.valAxisMajorUnit = props.valAxisMajorUnit;
|
|
1586
|
-
|
|
1587
|
-
|
|
1629
|
+
applyLabelFont(
|
|
1630
|
+
"valAxisLabelFontFace",
|
|
1631
|
+
"valAxisLabelFontBold",
|
|
1632
|
+
props.valAxisLabelFontFace,
|
|
1633
|
+
props.valAxisLabelFontWeight
|
|
1634
|
+
);
|
|
1588
1635
|
if (props.valGridLine !== void 0)
|
|
1589
1636
|
opts.valGridLine = resolveGridLine(props.valGridLine, theme, warnings);
|
|
1590
1637
|
if (props.barDir !== void 0) opts.barDir = props.barDir;
|
|
@@ -1606,10 +1653,14 @@ function renderChartComponent(slide, props, theme, _pptx, warnings) {
|
|
|
1606
1653
|
opts.dataLabelColor = props.dataLabelColor ? resolveColor(props.dataLabelColor, theme, warnings) : themeTextColor;
|
|
1607
1654
|
if (props.dataLabelFontSize !== void 0)
|
|
1608
1655
|
opts.dataLabelFontSize = props.dataLabelFontSize;
|
|
1609
|
-
if (props.dataLabelFontFace !== void 0)
|
|
1610
|
-
opts.dataLabelFontFace = props.dataLabelFontFace;
|
|
1611
1656
|
if (props.dataLabelFontBold !== void 0)
|
|
1612
1657
|
opts.dataLabelFontBold = props.dataLabelFontBold;
|
|
1658
|
+
applyLabelFont(
|
|
1659
|
+
"dataLabelFontFace",
|
|
1660
|
+
"dataLabelFontBold",
|
|
1661
|
+
props.dataLabelFontFace,
|
|
1662
|
+
props.dataLabelFontWeight
|
|
1663
|
+
);
|
|
1613
1664
|
if (props.dataLabelPosition !== void 0)
|
|
1614
1665
|
opts.dataLabelPosition = props.dataLabelPosition;
|
|
1615
1666
|
slide.addChart(chartType, data, opts);
|
|
@@ -1922,7 +1973,10 @@ async function renderPresentation(processed, warnings, pendingFills) {
|
|
|
1922
1973
|
import {
|
|
1923
1974
|
collectFontNamesFromPptx,
|
|
1924
1975
|
validateFontReferences,
|
|
1925
|
-
FontRegistry
|
|
1976
|
+
FontRegistry,
|
|
1977
|
+
documentFontRegistry,
|
|
1978
|
+
themeFontRegistry,
|
|
1979
|
+
mergeFontRegistries
|
|
1926
1980
|
} from "@json-to-office/shared";
|
|
1927
1981
|
import {
|
|
1928
1982
|
loadFileFontSource,
|
|
@@ -1934,9 +1988,14 @@ async function resolveDocumentFonts(document, theme, warnings, fonts) {
|
|
|
1934
1988
|
for (const n of collectFontNamesFromPptx(document)) names.add(n);
|
|
1935
1989
|
for (const n of collectFontNamesFromPptx(theme)) names.add(n);
|
|
1936
1990
|
if (names.size === 0) return [];
|
|
1991
|
+
const registryEntries = mergeFontRegistries(
|
|
1992
|
+
themeFontRegistry(theme),
|
|
1993
|
+
documentFontRegistry(document),
|
|
1994
|
+
fonts?.extraEntries
|
|
1995
|
+
);
|
|
1937
1996
|
const validation = validateFontReferences({
|
|
1938
1997
|
referencedNames: names,
|
|
1939
|
-
registeredEntries:
|
|
1998
|
+
registeredEntries: registryEntries
|
|
1940
1999
|
});
|
|
1941
2000
|
if (validation.warnings.length > 0) {
|
|
1942
2001
|
if (fonts?.strict) {
|
|
@@ -1953,7 +2012,9 @@ async function resolveDocumentFonts(document, theme, warnings, fonts) {
|
|
|
1953
2012
|
}
|
|
1954
2013
|
if (!fonts?.onResolved) return [];
|
|
1955
2014
|
const registry = new FontRegistry({
|
|
1956
|
-
|
|
2015
|
+
// Spread keeps baseDir/googleFonts/mode/substitution intact for
|
|
2016
|
+
// materializeSource; extraEntries carries the merged registry.
|
|
2017
|
+
opts: { ...fonts, extraEntries: registryEntries },
|
|
1957
2018
|
fileLoader: loadFileFontSource,
|
|
1958
2019
|
variableLoader: fetchVariableFontSource,
|
|
1959
2020
|
diskCache: fonts?.googleFonts?.cacheDir ? new FontDiskCache(fonts.googleFonts.cacheDir) : void 0
|
|
@@ -2014,6 +2075,142 @@ import {
|
|
|
2014
2075
|
|
|
2015
2076
|
// src/core/packagePresentation.ts
|
|
2016
2077
|
import JSZip from "jszip";
|
|
2078
|
+
|
|
2079
|
+
// src/core/svgRasterFallback.ts
|
|
2080
|
+
import path3 from "path";
|
|
2081
|
+
var EMU_PER_INCH = 914400;
|
|
2082
|
+
var RASTER_SCALE = 3;
|
|
2083
|
+
var MAX_EDGE_PX = 4096;
|
|
2084
|
+
var MIN_EDGE_PX = 16;
|
|
2085
|
+
var DEFAULT_EDGE_PX = 1024;
|
|
2086
|
+
var PART_PATTERNS = [
|
|
2087
|
+
/^ppt\/slides\/slide\d+\.xml$/,
|
|
2088
|
+
/^ppt\/slideLayouts\/[^/]+\.xml$/,
|
|
2089
|
+
/^ppt\/slideMasters\/[^/]+\.xml$/
|
|
2090
|
+
];
|
|
2091
|
+
var SVG_BLIP = /<asvg:svgBlip\b[^>]*r:embed="([^"]+)"/g;
|
|
2092
|
+
var BLIP = /<a:blip\b[^>]*r:embed="([^"]+)"/g;
|
|
2093
|
+
var EXTENT = /<a:ext\s+cx="(\d+)"\s+cy="(\d+)"/;
|
|
2094
|
+
var RELATIONSHIP = /<Relationship\b([^>]*)>/g;
|
|
2095
|
+
var resvgModule;
|
|
2096
|
+
function loadResvg() {
|
|
2097
|
+
resvgModule ??= import("@resvg/resvg-js");
|
|
2098
|
+
return resvgModule;
|
|
2099
|
+
}
|
|
2100
|
+
async function readRelationships(zip, partPath) {
|
|
2101
|
+
const dir = path3.posix.dirname(partPath);
|
|
2102
|
+
const relsPath = `${dir}/_rels/${path3.posix.basename(partPath)}.rels`;
|
|
2103
|
+
const targets = /* @__PURE__ */ new Map();
|
|
2104
|
+
const entry = zip.file(relsPath);
|
|
2105
|
+
if (!entry) return targets;
|
|
2106
|
+
const xml = await entry.async("string");
|
|
2107
|
+
for (const match of xml.matchAll(RELATIONSHIP)) {
|
|
2108
|
+
const attrs = match[1];
|
|
2109
|
+
if (/\bTargetMode="External"/.test(attrs)) continue;
|
|
2110
|
+
const id = /\bId="([^"]+)"/.exec(attrs)?.[1];
|
|
2111
|
+
const target = /\bTarget="([^"]+)"/.exec(attrs)?.[1];
|
|
2112
|
+
if (!id || !target) continue;
|
|
2113
|
+
targets.set(
|
|
2114
|
+
id,
|
|
2115
|
+
target.startsWith("/") ? target.slice(1) : path3.posix.normalize(path3.posix.join(dir, target))
|
|
2116
|
+
);
|
|
2117
|
+
}
|
|
2118
|
+
return targets;
|
|
2119
|
+
}
|
|
2120
|
+
function collectWorkItems(xml, rels, items) {
|
|
2121
|
+
const blips = [...xml.matchAll(BLIP)];
|
|
2122
|
+
for (const svgBlip of xml.matchAll(SVG_BLIP)) {
|
|
2123
|
+
const at = svgBlip.index ?? 0;
|
|
2124
|
+
const preview = blips.filter((blip) => (blip.index ?? 0) < at).pop();
|
|
2125
|
+
if (!preview) continue;
|
|
2126
|
+
const pngPart = rels.get(preview[1]);
|
|
2127
|
+
const svgPart = rels.get(svgBlip[1]);
|
|
2128
|
+
if (!pngPart || !svgPart) continue;
|
|
2129
|
+
const picEnd = xml.indexOf("</p:pic>", at);
|
|
2130
|
+
const extent = EXTENT.exec(picEnd === -1 ? "" : xml.slice(at, picEnd));
|
|
2131
|
+
const cx = extent ? Number(extent[1]) : void 0;
|
|
2132
|
+
const cy = extent ? Number(extent[2]) : void 0;
|
|
2133
|
+
const existing = items.get(pngPart);
|
|
2134
|
+
items.set(pngPart, {
|
|
2135
|
+
svgPart,
|
|
2136
|
+
cx: Math.max(cx ?? 0, existing?.cx ?? 0) || void 0,
|
|
2137
|
+
cy: Math.max(cy ?? 0, existing?.cy ?? 0) || void 0
|
|
2138
|
+
});
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
function toPixels(emu) {
|
|
2142
|
+
const px = Math.round(emu / EMU_PER_INCH * 96 * RASTER_SCALE);
|
|
2143
|
+
return Math.min(MAX_EDGE_PX, Math.max(MIN_EDGE_PX, px));
|
|
2144
|
+
}
|
|
2145
|
+
function resolveFitTo(intrinsicAspect, cx, cy) {
|
|
2146
|
+
if (!cx || !cy) return { mode: "width", value: DEFAULT_EDGE_PX };
|
|
2147
|
+
const wide = intrinsicAspect > cx / cy;
|
|
2148
|
+
const mode = wide ? "height" : "width";
|
|
2149
|
+
let value = wide ? toPixels(cy) : toPixels(cx);
|
|
2150
|
+
const other = wide ? Math.round(value * intrinsicAspect) : Math.round(value / intrinsicAspect);
|
|
2151
|
+
const longest = Math.max(value, other);
|
|
2152
|
+
if (longest > MAX_EDGE_PX) {
|
|
2153
|
+
value = Math.max(MIN_EDGE_PX, Math.floor(value * MAX_EDGE_PX / longest));
|
|
2154
|
+
}
|
|
2155
|
+
return { mode, value };
|
|
2156
|
+
}
|
|
2157
|
+
async function repairSvgRasterFallbacks(zip, warnings) {
|
|
2158
|
+
const pending = /* @__PURE__ */ new Map();
|
|
2159
|
+
for (const [partPath, entry] of Object.entries(zip.files)) {
|
|
2160
|
+
if (entry.dir || !PART_PATTERNS.some((rule) => rule.test(partPath))) {
|
|
2161
|
+
continue;
|
|
2162
|
+
}
|
|
2163
|
+
const xml = await entry.async("string");
|
|
2164
|
+
if (!xml.includes("asvg:svgBlip")) continue;
|
|
2165
|
+
collectWorkItems(xml, await readRelationships(zip, partPath), pending);
|
|
2166
|
+
}
|
|
2167
|
+
if (pending.size === 0) return false;
|
|
2168
|
+
let Resvg;
|
|
2169
|
+
try {
|
|
2170
|
+
({ Resvg } = await loadResvg());
|
|
2171
|
+
} catch (error) {
|
|
2172
|
+
warn(
|
|
2173
|
+
warnings,
|
|
2174
|
+
W.IMAGE_SVG_RASTER_FAILED,
|
|
2175
|
+
`Could not load the SVG rasterizer, so inline SVG images keep PowerPoint's broken-image fallback: ${String(error)}`,
|
|
2176
|
+
{ component: "image" }
|
|
2177
|
+
);
|
|
2178
|
+
return false;
|
|
2179
|
+
}
|
|
2180
|
+
const rendered = /* @__PURE__ */ new Map();
|
|
2181
|
+
let changed = false;
|
|
2182
|
+
for (const [pngPart, item] of pending) {
|
|
2183
|
+
try {
|
|
2184
|
+
if (!zip.file(pngPart)) {
|
|
2185
|
+
throw new Error(`missing preview part ${pngPart}`);
|
|
2186
|
+
}
|
|
2187
|
+
const source = zip.file(item.svgPart);
|
|
2188
|
+
if (!source) throw new Error(`missing part ${item.svgPart}`);
|
|
2189
|
+
const svg = await source.async("string");
|
|
2190
|
+
const probe2 = new Resvg(svg);
|
|
2191
|
+
const fitTo = resolveFitTo(probe2.width / probe2.height, item.cx, item.cy);
|
|
2192
|
+
const key = `${fitTo.mode}:${fitTo.value}
|
|
2193
|
+
${svg}`;
|
|
2194
|
+
let png = rendered.get(key);
|
|
2195
|
+
if (!png) {
|
|
2196
|
+
png = Buffer.from(new Resvg(svg, { fitTo }).render().asPng());
|
|
2197
|
+
rendered.set(key, png);
|
|
2198
|
+
}
|
|
2199
|
+
zip.file(pngPart, png);
|
|
2200
|
+
changed = true;
|
|
2201
|
+
} catch (error) {
|
|
2202
|
+
warn(
|
|
2203
|
+
warnings,
|
|
2204
|
+
W.IMAGE_SVG_RASTER_FAILED,
|
|
2205
|
+
`Could not rasterize ${item.svgPart}, so it keeps PowerPoint's broken-image fallback: ${String(error)}`,
|
|
2206
|
+
{ component: "image" }
|
|
2207
|
+
);
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
return changed;
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
// src/core/packagePresentation.ts
|
|
2017
2214
|
var MEDIUM_STYLE_2_ACCENT_1 = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
|
|
2018
2215
|
var NO_STYLE_NO_GRID = "{2D5ABB26-0587-4C30-8999-92F81FD0307C}";
|
|
2019
2216
|
var DEFAULT_GENERATED_AT = "2000-01-01T00:00:00.000Z";
|
|
@@ -2067,24 +2264,24 @@ function remapChartReferences(value, chartIds) {
|
|
|
2067
2264
|
);
|
|
2068
2265
|
}
|
|
2069
2266
|
async function canonicalizeChartIds(zip) {
|
|
2070
|
-
const sourceIds = Object.keys(zip.files).map((
|
|
2267
|
+
const sourceIds = Object.keys(zip.files).map((path4) => path4.match(/^ppt\/charts\/chart(\d+)\.xml$/)?.[1]).filter((value) => value !== void 0).map(Number).sort((a, b) => a - b);
|
|
2071
2268
|
const chartIds = new Map(sourceIds.map((id, index) => [id, index + 1]));
|
|
2072
2269
|
if (chartIds.size === 0) return;
|
|
2073
|
-
for (const [
|
|
2074
|
-
if (entry.dir || !
|
|
2270
|
+
for (const [path4, entry] of Object.entries(zip.files)) {
|
|
2271
|
+
if (entry.dir || !path4.endsWith(".xml") && !path4.endsWith(".rels")) {
|
|
2075
2272
|
continue;
|
|
2076
2273
|
}
|
|
2077
2274
|
const xml = await entry.async("string");
|
|
2078
2275
|
const remapped = remapChartReferences(xml, chartIds);
|
|
2079
|
-
if (remapped !== xml) zip.file(
|
|
2276
|
+
if (remapped !== xml) zip.file(path4, remapped);
|
|
2080
2277
|
}
|
|
2081
2278
|
const renames = [];
|
|
2082
|
-
for (const [
|
|
2279
|
+
for (const [path4, entry] of Object.entries(zip.files)) {
|
|
2083
2280
|
if (entry.dir) continue;
|
|
2084
|
-
const remappedPath = remapChartReferences(
|
|
2085
|
-
if (remappedPath ===
|
|
2281
|
+
const remappedPath = remapChartReferences(path4, chartIds);
|
|
2282
|
+
if (remappedPath === path4) continue;
|
|
2086
2283
|
renames.push({
|
|
2087
|
-
from:
|
|
2284
|
+
from: path4,
|
|
2088
2285
|
to: remappedPath,
|
|
2089
2286
|
data: await entry.async("nodebuffer"),
|
|
2090
2287
|
date: entry.date
|
|
@@ -2114,12 +2311,12 @@ async function canonicalizePackage(zip, generatedAt, depth = 0) {
|
|
|
2114
2311
|
zip.file("docProps/core.xml", coreXml);
|
|
2115
2312
|
}
|
|
2116
2313
|
if (depth < 3) {
|
|
2117
|
-
for (const [
|
|
2118
|
-
if (entry.dir || !EMBEDDED_OFFICE_PACKAGE.test(
|
|
2314
|
+
for (const [path4, entry] of Object.entries(zip.files)) {
|
|
2315
|
+
if (entry.dir || !EMBEDDED_OFFICE_PACKAGE.test(path4)) continue;
|
|
2119
2316
|
try {
|
|
2120
2317
|
const nested = await JSZip.loadAsync(await entry.async("nodebuffer"));
|
|
2121
2318
|
await canonicalizePackage(nested, generatedAt, depth + 1);
|
|
2122
|
-
zip.file(
|
|
2319
|
+
zip.file(path4, await generateZip(nested));
|
|
2123
2320
|
} catch {
|
|
2124
2321
|
}
|
|
2125
2322
|
}
|
|
@@ -2131,8 +2328,8 @@ async function canonicalizePackage(zip, generatedAt, depth = 0) {
|
|
|
2131
2328
|
async function packagePresentationBuffer(buffer, options = {}) {
|
|
2132
2329
|
const zip = await JSZip.loadAsync(buffer);
|
|
2133
2330
|
let changed = false;
|
|
2134
|
-
for (const [
|
|
2135
|
-
if (!
|
|
2331
|
+
for (const [path4, entry] of Object.entries(zip.files)) {
|
|
2332
|
+
if (!path4.match(/^ppt\/slides\/slide\d+\.xml$/)) continue;
|
|
2136
2333
|
let xml = await entry.async("string");
|
|
2137
2334
|
let fileChanged = false;
|
|
2138
2335
|
if (xml.includes(MEDIUM_STYLE_2_ACCENT_1)) {
|
|
@@ -2147,10 +2344,11 @@ async function packagePresentationBuffer(buffer, options = {}) {
|
|
|
2147
2344
|
}
|
|
2148
2345
|
}
|
|
2149
2346
|
if (fileChanged) {
|
|
2150
|
-
zip.file(
|
|
2347
|
+
zip.file(path4, xml);
|
|
2151
2348
|
changed = true;
|
|
2152
2349
|
}
|
|
2153
2350
|
}
|
|
2351
|
+
changed = await repairSvgRasterFallbacks(zip, options.warnings) || changed;
|
|
2154
2352
|
if (options.deterministic !== false) {
|
|
2155
2353
|
const generatedAt = resolveGeneratedAt(options.generatedAt);
|
|
2156
2354
|
await canonicalizeChartIds(zip);
|
|
@@ -2254,7 +2452,8 @@ async function generateBufferWithWarnings(jsonConfig, options) {
|
|
|
2254
2452
|
const data = await pptx.write({ outputType: "nodebuffer" });
|
|
2255
2453
|
const buffer = await packagePresentationBuffer(data, {
|
|
2256
2454
|
...options,
|
|
2257
|
-
pendingFills
|
|
2455
|
+
pendingFills,
|
|
2456
|
+
warnings
|
|
2258
2457
|
});
|
|
2259
2458
|
return { buffer, warnings };
|
|
2260
2459
|
}
|
|
@@ -2642,7 +2841,8 @@ function createBuilderImpl(state) {
|
|
|
2642
2841
|
const buffer = await packagePresentationBuffer(data, {
|
|
2643
2842
|
deterministic: options?.deterministic ?? state.packaging.deterministic,
|
|
2644
2843
|
generatedAt: options?.generatedAt ?? state.packaging.generatedAt,
|
|
2645
|
-
pendingFills
|
|
2844
|
+
pendingFills,
|
|
2845
|
+
warnings
|
|
2646
2846
|
});
|
|
2647
2847
|
return { buffer, warnings };
|
|
2648
2848
|
} catch (error) {
|