@json-to-office/core-pptx 0.9.0 → 0.12.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":"highcharts.d.ts","sourceRoot":"","sources":["../../src/components/highcharts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAmEtE,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,eAAe,EACvB,SAAS,CAAC,EAAE,eAAe,EAAE,EAC7B,cAAc,CAAC,EAAE,uBAAuB,GACvC,OAAO,CAAC,IAAI,CAAC,CAaf"}
1
+ {"version":3,"file":"highcharts.d.ts","sourceRoot":"","sources":["../../src/components/highcharts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AA0EtE,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,eAAe,EACvB,SAAS,CAAC,EAAE,eAAe,EAAE,EAC7B,cAAc,CAAC,EAAE,uBAAuB,GACvC,OAAO,CAAC,IAAI,CAAC,CAaf"}
package/dist/index.js CHANGED
@@ -1060,19 +1060,21 @@ async function generateChart(config, servicesConfig) {
1060
1060
  config.serverUrl,
1061
1061
  servicesConfig?.serverUrl
1062
1062
  );
1063
+ const requestBody = {
1064
+ infile: config.options,
1065
+ type: "png",
1066
+ b64: true,
1067
+ scale: config.scale
1068
+ };
1069
+ const resolvedHeaders = typeof servicesConfig?.headers === "function" ? await servicesConfig.headers(requestBody) : servicesConfig?.headers;
1063
1070
  const headers = {
1064
1071
  "Content-Type": "application/json",
1065
- ...servicesConfig?.headers
1072
+ ...resolvedHeaders
1066
1073
  };
1067
1074
  const response = await fetch(`${serverUrl}/export`, {
1068
1075
  method: "POST",
1069
1076
  headers,
1070
- body: JSON.stringify({
1071
- infile: config.options,
1072
- type: "png",
1073
- b64: true,
1074
- scale: config.scale
1075
- })
1077
+ body: JSON.stringify(requestBody)
1076
1078
  }).catch((error) => {
1077
1079
  throw new Error(
1078
1080
  `Highcharts Export Server is not running at ${serverUrl}. Start it with: npx highcharts-export-server --enableServer true
@@ -1892,8 +1894,9 @@ function createBuilderImpl(state) {
1892
1894
  if (!internalDocument || internalDocument.name !== "pptx") {
1893
1895
  throw new Error("Top-level component must be a pptx component");
1894
1896
  }
1895
- const baseThemeName = typeof state.theme === "string" ? state.theme : internalDocument.props.theme ?? "default";
1896
- let resolvedTheme = typeof state.theme === "object" ? state.theme : state.customThemes?.[baseThemeName] ?? getPptxTheme(baseThemeName);
1897
+ const docThemeName = internalDocument.props.theme;
1898
+ const baseThemeName = docThemeName ?? (typeof state.theme === "string" ? state.theme : "default");
1899
+ let resolvedTheme = state.customThemes?.[baseThemeName] ?? (typeof state.theme === "object" && state.theme !== null ? state.theme : getPptxTheme(baseThemeName));
1897
1900
  const warnings = [];
1898
1901
  const mode = applyExportMode2({
1899
1902
  doc: internalDocument,