@json-to-office/core-pptx 5.3.0 → 6.0.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandHighcharts.d.ts","sourceRoot":"","sources":["../../src/core/expandHighcharts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"expandHighcharts.d.ts","sourceRoot":"","sources":["../../src/core/expandHighcharts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAeL,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,eAAe,EAGf,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAUlB,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,qBAAqB,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,qBAAqB,EACnC,QAAQ,EAAE,uBAAuB,GAAG,SAAS,EAC7C,QAAQ,EAAE,eAAe,EAAE,EAC3B,UAAU,CAAC,EAAE,SAAS,iBAAiB,EAAE,GACxC,OAAO,CAAC,yBAAyB,CAAC,CAwBpC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type { PptxRendererId } from './renderers/types';
|
|
|
5
5
|
export { DEFAULT_PPTX_RENDERER_ID } from './renderers/types';
|
|
6
6
|
export { isPptxRendererId, pptxRendererIds, pptxRendererStatuses, } from './renderers/registry';
|
|
7
7
|
export { UncompiledComponentError } from './core/generateFromIr';
|
|
8
|
+
export { getChartRequestStats, resetChartRequestStats, type ChartRequestStats, } from '@json-to-office/shared';
|
|
8
9
|
export { DEFAULT_GENERATED_AT } from './core/finalizePackage';
|
|
9
10
|
export type { PresentationPackagingOptions } from './core/finalizePackage';
|
|
10
11
|
export type { PptxComponentInput, PresentationComponentDefinition, PresentationComponentDefinitionFor, SlideComponentDefinition, ProcessedPresentation, ProcessedSlide, PptxThemeConfig, PipelineWarning, SlideContext, SlideRenderContext, } from './types';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAGD,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,iCAAiC,EACjC,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAGD,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,iCAAiC,EACjC,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,M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AAiB,CAAC;AACzB,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/D,OAAO,EACL,eAAe,EACf,aAAa,EACb,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,gCAAgC,EAChC,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,4BAA4B,EAC5B,qBAAqB,IAAI,2BAA2B,EACpD,4BAA4B,EAC5B,sBAAsB,IAAI,4BAA4B,EACtD,oBAAoB,IAAI,0BAA0B,EAClD,mBAAmB,IAAI,yBAAyB,EAChD,eAAe,IAAI,qBAAqB,EACxC,2BAA2B,IAAI,iCAAiC,EAChE,gBAAgB,IAAI,sBAAsB,EAC1C,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,eAAe,IAAI,qBAAqB,GACzC,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3937,6 +3937,12 @@ import {
|
|
|
3937
3937
|
REMOTE_EXPORT_WARNING,
|
|
3938
3938
|
chartFamilyResolver,
|
|
3939
3939
|
chartPointsPerPixel,
|
|
3940
|
+
chartRequestKey,
|
|
3941
|
+
dedupeChartRequest,
|
|
3942
|
+
limitChartRequest,
|
|
3943
|
+
postJsonToService,
|
|
3944
|
+
recordChartRetry,
|
|
3945
|
+
resolveServiceUrl,
|
|
3940
3946
|
withChartFontFaceCss,
|
|
3941
3947
|
withChartTypography
|
|
3942
3948
|
} from "@json-to-office/shared";
|
|
@@ -3956,7 +3962,10 @@ async function expandHighchartsComponents(presentation, services, warnings, char
|
|
|
3956
3962
|
slideWidth: presentation.slideWidth,
|
|
3957
3963
|
services,
|
|
3958
3964
|
warnings,
|
|
3959
|
-
chartFonts
|
|
3965
|
+
chartFonts,
|
|
3966
|
+
// Per deck: a chart repeated on an agenda slide and again in its section
|
|
3967
|
+
// is one render.
|
|
3968
|
+
chartCache: /* @__PURE__ */ new Map()
|
|
3960
3969
|
};
|
|
3961
3970
|
const slides = await Promise.all(
|
|
3962
3971
|
presentation.slides.map(async (slide, index) => ({
|
|
@@ -3992,19 +4001,24 @@ async function expandList(components, path4, scope) {
|
|
|
3992
4001
|
}
|
|
3993
4002
|
async function expandOne(component, path4, scope) {
|
|
3994
4003
|
const props = component.props;
|
|
3995
|
-
const chart = await
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4004
|
+
const chart = await limitChartRequest(
|
|
4005
|
+
exportServerUrl(props.serverUrl, scope.services?.serverUrl),
|
|
4006
|
+
scope.services?.concurrency,
|
|
4007
|
+
() => renderChart(
|
|
4008
|
+
withChartFontFaces(
|
|
4009
|
+
withThemeTypography(
|
|
4010
|
+
withThemeColors(props, scope.theme, scope.warnings),
|
|
4011
|
+
scope.theme,
|
|
4012
|
+
scope.slideWidth,
|
|
4013
|
+
scope.warnings
|
|
4014
|
+
),
|
|
3999
4015
|
scope.theme,
|
|
4000
|
-
scope.
|
|
4001
|
-
scope.warnings
|
|
4016
|
+
scope.chartFonts
|
|
4002
4017
|
),
|
|
4003
|
-
scope.
|
|
4004
|
-
scope.
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
scope.warnings
|
|
4018
|
+
scope.services,
|
|
4019
|
+
scope.warnings,
|
|
4020
|
+
scope.chartCache
|
|
4021
|
+
)
|
|
4008
4022
|
);
|
|
4009
4023
|
void path4;
|
|
4010
4024
|
return {
|
|
@@ -4021,14 +4035,18 @@ async function expandOne(component, path4, scope) {
|
|
|
4021
4035
|
}
|
|
4022
4036
|
function assertExportServerAllowed(serverUrl, services, warnings) {
|
|
4023
4037
|
const notice = remoteExportNotice(serverUrl, services?.allowRemote);
|
|
4024
|
-
if (notice)
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4038
|
+
if (!notice) return;
|
|
4039
|
+
const alreadySaid = warnings.some(
|
|
4040
|
+
(warning) => warning.code === REMOTE_EXPORT_WARNING && warning.message === notice
|
|
4041
|
+
);
|
|
4042
|
+
if (alreadySaid) return;
|
|
4043
|
+
warnings.push({
|
|
4044
|
+
code: REMOTE_EXPORT_WARNING,
|
|
4045
|
+
component: "highcharts",
|
|
4046
|
+
message: notice
|
|
4047
|
+
});
|
|
4030
4048
|
}
|
|
4031
|
-
async function renderChart(config, services, warnings) {
|
|
4049
|
+
async function renderChart(config, services, warnings, cache) {
|
|
4032
4050
|
if (!isNodeEnvironment()) {
|
|
4033
4051
|
throw new Error(
|
|
4034
4052
|
"Highcharts export server requires a Node.js environment. Chart generation is not available in browser environments."
|
|
@@ -4045,25 +4063,27 @@ async function renderChart(config, services, warnings) {
|
|
|
4045
4063
|
// for callers that omit it.
|
|
4046
4064
|
...config.resources ? { resources: config.resources } : {}
|
|
4047
4065
|
};
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4066
|
+
return dedupeChartRequest(
|
|
4067
|
+
cache,
|
|
4068
|
+
chartRequestKey(serverUrl, requestBody),
|
|
4069
|
+
() => postChart(serverUrl, requestBody, config, services)
|
|
4070
|
+
);
|
|
4071
|
+
}
|
|
4072
|
+
async function postChart(serverUrl, requestBody, config, services) {
|
|
4073
|
+
const response = await postJsonToService({
|
|
4074
|
+
url: serverUrl,
|
|
4075
|
+
path: "/export",
|
|
4076
|
+
body: requestBody,
|
|
4077
|
+
headers: services?.headers,
|
|
4078
|
+
timeoutMs: services?.timeoutMs,
|
|
4079
|
+
retries: services?.retries,
|
|
4080
|
+
onRetry: recordChartRetry,
|
|
4081
|
+
serviceLabel: "Highcharts export server",
|
|
4082
|
+
// The code lets a server route report a missing export server as a
|
|
4083
|
+
// dependency outage with this message, not as an internal error.
|
|
4084
|
+
onUnreachable: (url, cause) => `Highcharts Export Server is not running at ${url}. Start it with: npx highcharts-export-server --enableServer true
|
|
4085
|
+
Cause: ${cause}`
|
|
4061
4086
|
});
|
|
4062
|
-
if (!response.ok) {
|
|
4063
|
-
throw new Error(
|
|
4064
|
-
`Highcharts export server returned ${response.status}: ${response.statusText}`
|
|
4065
|
-
);
|
|
4066
|
-
}
|
|
4067
4087
|
return {
|
|
4068
4088
|
dataUri: `data:image/png;base64,${await response.text()}`,
|
|
4069
4089
|
widthPx: config.options.chart?.width ?? DEFAULT_CHART_WIDTH_PX,
|
|
@@ -4071,8 +4091,7 @@ Cause: ${error instanceof Error ? error.message : String(error)}`
|
|
|
4071
4091
|
};
|
|
4072
4092
|
}
|
|
4073
4093
|
function exportServerUrl(propsUrl, servicesUrl) {
|
|
4074
|
-
|
|
4075
|
-
return raw.startsWith("http") ? raw : `http://${raw}`;
|
|
4094
|
+
return resolveServiceUrl(propsUrl, servicesUrl, DEFAULT_EXPORT_SERVER_URL);
|
|
4076
4095
|
}
|
|
4077
4096
|
function withThemeColors(props, theme, warnings) {
|
|
4078
4097
|
if (!props.options || props.options.colors || !theme?.colors) return props;
|
|
@@ -4784,7 +4803,7 @@ var vermilion_pptx_theme_default = {
|
|
|
4784
4803
|
},
|
|
4785
4804
|
actionTitle: {
|
|
4786
4805
|
type: "display",
|
|
4787
|
-
color: "
|
|
4806
|
+
color: "accent"
|
|
4788
4807
|
},
|
|
4789
4808
|
keyTakeaways: {
|
|
4790
4809
|
type: "label",
|
|
@@ -4813,7 +4832,7 @@ var vermilion_pptx_theme_default = {
|
|
|
4813
4832
|
},
|
|
4814
4833
|
cover: {
|
|
4815
4834
|
type: "display",
|
|
4816
|
-
color: "
|
|
4835
|
+
color: "accent",
|
|
4817
4836
|
rule: {
|
|
4818
4837
|
weightPt: 4,
|
|
4819
4838
|
color: "accent"
|
|
@@ -5244,12 +5263,15 @@ var pptxThemes = PPTX_THEMES;
|
|
|
5244
5263
|
// src/themes/design-system.ts
|
|
5245
5264
|
import {
|
|
5246
5265
|
designCanvas,
|
|
5266
|
+
resolveMotif,
|
|
5247
5267
|
resolveTypeRoles,
|
|
5248
5268
|
validateDesignColors
|
|
5249
5269
|
} from "@json-to-office/shared";
|
|
5250
5270
|
function resolvePptxDesignSystem(theme, width = 10, height = 7.5) {
|
|
5251
5271
|
validateDesignColors(theme, theme.colors);
|
|
5252
|
-
|
|
5272
|
+
const motif = resolveMotif(theme.motif);
|
|
5273
|
+
if (!theme.typography)
|
|
5274
|
+
return motif === theme.motif ? theme : withMotif(theme, motif);
|
|
5253
5275
|
const canvas = designCanvas("pptx", { width, height });
|
|
5254
5276
|
const roles = resolveTypeRoles(theme, canvas, theme.defaults.fontSize);
|
|
5255
5277
|
const styles = { ...theme.styles };
|
|
@@ -5276,7 +5298,13 @@ function resolvePptxDesignSystem(theme, width = 10, height = 7.5) {
|
|
|
5276
5298
|
...styles[key]
|
|
5277
5299
|
};
|
|
5278
5300
|
}
|
|
5279
|
-
return { ...theme, styles };
|
|
5301
|
+
return { ...withMotif(theme, motif), styles };
|
|
5302
|
+
}
|
|
5303
|
+
function withMotif(theme, motif) {
|
|
5304
|
+
if (motif !== void 0) return { ...theme, motif };
|
|
5305
|
+
const rest = { ...theme };
|
|
5306
|
+
delete rest.motif;
|
|
5307
|
+
return rest;
|
|
5280
5308
|
}
|
|
5281
5309
|
function designGrid(theme, width, height) {
|
|
5282
5310
|
const space = theme.spacing?.canvas?.[designCanvas("pptx", { width, height })];
|
|
@@ -6816,6 +6844,10 @@ var PresentationGenerator = {
|
|
|
6816
6844
|
// src/index.ts
|
|
6817
6845
|
init_finalizePackage();
|
|
6818
6846
|
init_warn();
|
|
6847
|
+
import {
|
|
6848
|
+
getChartRequestStats,
|
|
6849
|
+
resetChartRequestStats
|
|
6850
|
+
} from "@json-to-office/shared";
|
|
6819
6851
|
|
|
6820
6852
|
// src/blueprints/index.ts
|
|
6821
6853
|
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
@@ -8792,6 +8824,7 @@ export {
|
|
|
8792
8824
|
generateBufferWithWarnings,
|
|
8793
8825
|
generateFromFile,
|
|
8794
8826
|
generatePluginPresentationSchema,
|
|
8827
|
+
getChartRequestStats,
|
|
8795
8828
|
getPptxCoreVersion,
|
|
8796
8829
|
getPptxTheme,
|
|
8797
8830
|
hasPptxTheme,
|
|
@@ -8806,6 +8839,7 @@ export {
|
|
|
8806
8839
|
pptxRendererStatuses,
|
|
8807
8840
|
pptxThemes,
|
|
8808
8841
|
preparePptxQualityDocument,
|
|
8842
|
+
resetChartRequestStats,
|
|
8809
8843
|
resolveComponentVersion3 as resolveComponentVersion,
|
|
8810
8844
|
resolvePptxQualityProfile,
|
|
8811
8845
|
toAuthoredPointer,
|