@json-to-office/core-pptx 5.4.0 → 6.1.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,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"}
1
+ {"version":3,"file":"expandHighcharts.d.ts","sourceRoot":"","sources":["../../src/core/expandHighcharts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAcL,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.js CHANGED
@@ -3937,12 +3937,11 @@ import {
3937
3937
  REMOTE_EXPORT_WARNING,
3938
3938
  chartFamilyResolver,
3939
3939
  chartPointsPerPixel,
3940
- chartRequestKey,
3941
- dedupeChartRequest,
3942
- limitChartRequest,
3943
3940
  postJsonToService,
3941
+ recordChartCollected,
3944
3942
  recordChartRetry,
3945
3943
  resolveServiceUrl,
3944
+ sendChartRequest,
3946
3945
  withChartFontFaceCss,
3947
3946
  withChartTypography
3948
3947
  } from "@json-to-office/shared";
@@ -4001,24 +4000,21 @@ async function expandList(components, path4, scope) {
4001
4000
  }
4002
4001
  async function expandOne(component, path4, scope) {
4003
4002
  const props = component.props;
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
- ),
4003
+ recordChartCollected();
4004
+ const chart = await renderChart(
4005
+ withChartFontFaces(
4006
+ withThemeTypography(
4007
+ withThemeColors(props, scope.theme, scope.warnings),
4015
4008
  scope.theme,
4016
- scope.chartFonts
4009
+ scope.slideWidth,
4010
+ scope.warnings
4017
4011
  ),
4018
- scope.services,
4019
- scope.warnings,
4020
- scope.chartCache
4021
- )
4012
+ scope.theme,
4013
+ scope.chartFonts
4014
+ ),
4015
+ scope.services,
4016
+ scope.warnings,
4017
+ scope.chartCache
4022
4018
  );
4023
4019
  void path4;
4024
4020
  return {
@@ -4063,14 +4059,16 @@ async function renderChart(config, services, warnings, cache) {
4063
4059
  // for callers that omit it.
4064
4060
  ...config.resources ? { resources: config.resources } : {}
4065
4061
  };
4066
- return dedupeChartRequest(
4062
+ return sendChartRequest({
4067
4063
  cache,
4068
- chartRequestKey(serverUrl, requestBody),
4069
- () => postChart(serverUrl, requestBody, config, services)
4070
- );
4064
+ serverUrl,
4065
+ concurrency: services?.concurrency,
4066
+ requestBody,
4067
+ send: () => postChart(serverUrl, requestBody, config, services)
4068
+ });
4071
4069
  }
4072
4070
  async function postChart(serverUrl, requestBody, config, services) {
4073
- const response = await postJsonToService({
4071
+ const base64Data = await postJsonToService({
4074
4072
  url: serverUrl,
4075
4073
  path: "/export",
4076
4074
  body: requestBody,
@@ -4082,10 +4080,11 @@ async function postChart(serverUrl, requestBody, config, services) {
4082
4080
  // The code lets a server route report a missing export server as a
4083
4081
  // dependency outage with this message, not as an internal error.
4084
4082
  onUnreachable: (url, cause) => `Highcharts Export Server is not running at ${url}. Start it with: npx highcharts-export-server --enableServer true
4085
- Cause: ${cause}`
4083
+ Cause: ${cause}`,
4084
+ decode: (response) => response.text()
4086
4085
  });
4087
4086
  return {
4088
- dataUri: `data:image/png;base64,${await response.text()}`,
4087
+ dataUri: `data:image/png;base64,${base64Data}`,
4089
4088
  widthPx: config.options.chart?.width ?? DEFAULT_CHART_WIDTH_PX,
4090
4089
  heightPx: config.options.chart?.height ?? 720
4091
4090
  };
@@ -4803,7 +4802,7 @@ var vermilion_pptx_theme_default = {
4803
4802
  },
4804
4803
  actionTitle: {
4805
4804
  type: "display",
4806
- color: "primary"
4805
+ color: "accent"
4807
4806
  },
4808
4807
  keyTakeaways: {
4809
4808
  type: "label",
@@ -4832,7 +4831,7 @@ var vermilion_pptx_theme_default = {
4832
4831
  },
4833
4832
  cover: {
4834
4833
  type: "display",
4835
- color: "primary",
4834
+ color: "accent",
4836
4835
  rule: {
4837
4836
  weightPt: 4,
4838
4837
  color: "accent"
@@ -5263,12 +5262,15 @@ var pptxThemes = PPTX_THEMES;
5263
5262
  // src/themes/design-system.ts
5264
5263
  import {
5265
5264
  designCanvas,
5265
+ resolveMotif,
5266
5266
  resolveTypeRoles,
5267
5267
  validateDesignColors
5268
5268
  } from "@json-to-office/shared";
5269
5269
  function resolvePptxDesignSystem(theme, width = 10, height = 7.5) {
5270
5270
  validateDesignColors(theme, theme.colors);
5271
- if (!theme.typography) return theme;
5271
+ const motif = resolveMotif(theme.motif);
5272
+ if (!theme.typography)
5273
+ return motif === theme.motif ? theme : withMotif(theme, motif);
5272
5274
  const canvas = designCanvas("pptx", { width, height });
5273
5275
  const roles = resolveTypeRoles(theme, canvas, theme.defaults.fontSize);
5274
5276
  const styles = { ...theme.styles };
@@ -5295,7 +5297,13 @@ function resolvePptxDesignSystem(theme, width = 10, height = 7.5) {
5295
5297
  ...styles[key]
5296
5298
  };
5297
5299
  }
5298
- return { ...theme, styles };
5300
+ return { ...withMotif(theme, motif), styles };
5301
+ }
5302
+ function withMotif(theme, motif) {
5303
+ if (motif !== void 0) return { ...theme, motif };
5304
+ const rest = { ...theme };
5305
+ delete rest.motif;
5306
+ return rest;
5299
5307
  }
5300
5308
  function designGrid(theme, width, height) {
5301
5309
  const space = theme.spacing?.canvas?.[designCanvas("pptx", { width, height })];