@json-to-office/core-pptx 0.3.0 → 0.7.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.
@@ -4,5 +4,6 @@
4
4
  import type PptxGenJS from 'pptxgenjs';
5
5
  import type { PptxThemeConfig, PipelineWarning } from '../types';
6
6
  import type { PptxHighchartsProps } from '@json-to-office/shared-pptx';
7
- export declare function renderHighchartsComponent(slide: PptxGenJS.Slide, props: PptxHighchartsProps, _theme: PptxThemeConfig, _warnings?: PipelineWarning[]): Promise<void>;
7
+ import type { HighchartsServiceConfig } from '@json-to-office/shared';
8
+ export declare function renderHighchartsComponent(slide: PptxGenJS.Slide, props: PptxHighchartsProps, _theme: PptxThemeConfig, _warnings?: PipelineWarning[], servicesConfig?: HighchartsServiceConfig): Promise<void>;
8
9
  //# sourceMappingURL=highcharts.d.ts.map
@@ -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;AAyDvE,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,eAAe,EACvB,SAAS,CAAC,EAAE,eAAe,EAAE,GAC5B,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;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"}
@@ -3,11 +3,12 @@
3
3
  */
4
4
  import type PptxGenJS from 'pptxgenjs';
5
5
  import type { PptxThemeConfig, PptxComponentInput, PipelineWarning, SlideContext } from '../types';
6
+ import type { ServicesConfig } from '@json-to-office/shared';
6
7
  export { renderTextComponent } from './text';
7
8
  export { renderImageComponent } from './image';
8
9
  export { renderShapeComponent } from './shape';
9
10
  export { renderTableComponent } from './table';
10
11
  export { renderHighchartsComponent } from './highcharts';
11
12
  export { renderChartComponent } from './chart';
12
- export declare function renderComponent(slide: PptxGenJS.Slide, component: PptxComponentInput, theme: PptxThemeConfig, pptx: PptxGenJS, warnings?: PipelineWarning[], slideCtx?: SlideContext): Promise<void>;
13
+ export declare function renderComponent(slide: PptxGenJS.Slide, component: PptxComponentInput, theme: PptxThemeConfig, pptx: PptxGenJS, warnings?: PipelineWarning[], slideCtx?: SlideContext, services?: ServicesConfig): Promise<void>;
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AASnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;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vB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,IAAI,CAAC,CAuCf"}
@@ -5,11 +5,13 @@
5
5
  /// <reference types="node" />
6
6
  import PptxGenJS from 'pptxgenjs';
7
7
  import type { PresentationComponentDefinition, PptxThemeConfig, PipelineWarning } from '../types';
8
+ import type { ServicesConfig } from '@json-to-office/shared';
8
9
  /**
9
10
  * Options for the generation pipeline
10
11
  */
11
12
  export interface GenerationOptions {
12
13
  customThemes?: Record<string, PptxThemeConfig>;
14
+ services?: ServicesConfig;
13
15
  }
14
16
  /**
15
17
  * Result from generateBufferWithWarnings
@@ -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;AAGlC,OAAO,KAAK,EAAE,+BAA+B,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAKlG;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,OAAO,GAClB,UAAU,IAAI,+BAA+B,CAI/C;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,+BAA+B,EACzC,OAAO,CAAC,EAAE,iBAAiB,EAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,OAAO,CAAC,SAAS,CAAC,CAOpB;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,GAAG,+BAA+B,EACpD,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED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C,SAAS,CAAC,CAiJpB"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/core/render.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAEhB,MAAM,UAAU,CAAC;AAOlB,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,qBAAqB,EAChC,QAAQ,CAAC,EAAE,eAAe,EAAE,GAC3B,OAAO,CAAC,SAAS,CAAC,CAiOpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/core/structure.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,+BAA+B,EAC/B,qBAAqB,EAGtB,MAAM,UAAU,CAAC;AAIlB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,+BAA+B,EACzC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,qBAAqB,CA4EvB"}
1
+ {"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/core/structure.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,+BAA+B,EAC/B,qBAAqB,EAGtB,MAAM,UAAU,CAAC;AAQlB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,+BAA+B,EACzC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,qBAAqB,CAyFvB"}
package/dist/index.js CHANGED
@@ -225,7 +225,12 @@ function processPresentation(document, options) {
225
225
  const effectiveGrid = mergeGridConfigs(props.grid, m.grid);
226
226
  const resolvedPhs = m.placeholders?.map((ph) => {
227
227
  if (!ph.grid) return ph;
228
- const abs = resolveGridPosition(ph.grid, effectiveGrid, slideWidth, slideHeight);
228
+ const abs = resolveGridPosition(
229
+ ph.grid,
230
+ effectiveGrid,
231
+ slideWidth,
232
+ slideHeight
233
+ );
229
234
  return {
230
235
  ...ph,
231
236
  x: ph.x ?? abs.x,
@@ -236,7 +241,12 @@ function processPresentation(document, options) {
236
241
  };
237
242
  });
238
243
  const resolvedObjects = m.objects?.map(
239
- (obj) => resolveComponentGridPosition(obj, effectiveGrid, slideWidth, slideHeight)
244
+ (obj) => resolveComponentGridPosition(
245
+ obj,
246
+ effectiveGrid,
247
+ slideWidth,
248
+ slideHeight
249
+ )
240
250
  );
241
251
  return { ...m, placeholders: resolvedPhs, objects: resolvedObjects };
242
252
  });
@@ -275,7 +285,8 @@ function processPresentation(document, options) {
275
285
  rtlMode: props.rtlMode ?? false,
276
286
  pageNumberFormat: props.pageNumberFormat ?? "9",
277
287
  slides,
278
- templates
288
+ templates,
289
+ services: options?.services
279
290
  };
280
291
  }
281
292
 
@@ -779,19 +790,27 @@ function isNodeEnvironment() {
779
790
  // src/components/highcharts.ts
780
791
  var PX_PER_INCH = 96;
781
792
  var DEFAULT_EXPORT_SERVER_URL = "http://localhost:7801";
782
- function getExportServerUrl(propsUrl) {
783
- return propsUrl || process.env.HIGHCHARTS_SERVER_URL || DEFAULT_EXPORT_SERVER_URL;
793
+ function getExportServerUrl(propsUrl, servicesUrl) {
794
+ const raw = propsUrl || servicesUrl || DEFAULT_EXPORT_SERVER_URL;
795
+ return raw.startsWith("http") ? raw : `http://${raw}`;
784
796
  }
785
- async function generateChart(config) {
797
+ async function generateChart(config, servicesConfig) {
786
798
  if (!isNodeEnvironment()) {
787
799
  throw new Error(
788
800
  "Highcharts export server requires a Node.js environment. Chart generation is not available in browser environments."
789
801
  );
790
802
  }
791
- const serverUrl = getExportServerUrl(config.serverUrl);
803
+ const serverUrl = getExportServerUrl(
804
+ config.serverUrl,
805
+ servicesConfig?.serverUrl
806
+ );
807
+ const headers = {
808
+ "Content-Type": "application/json",
809
+ ...servicesConfig?.headers
810
+ };
792
811
  const response = await fetch(`${serverUrl}/export`, {
793
812
  method: "POST",
794
- headers: { "Content-Type": "application/json" },
813
+ headers,
795
814
  body: JSON.stringify({
796
815
  infile: config.options,
797
816
  type: "png",
@@ -816,8 +835,8 @@ Cause: ${error instanceof Error ? error.message : String(error)}`
816
835
  height: config.options.chart?.height ?? 720
817
836
  };
818
837
  }
819
- async function renderHighchartsComponent(slide, props, _theme, _warnings) {
820
- const chart = await generateChart(props);
838
+ async function renderHighchartsComponent(slide, props, _theme, _warnings, servicesConfig) {
839
+ const chart = await generateChart(props, servicesConfig);
821
840
  const w = props.w ?? chart.width / PX_PER_INCH;
822
841
  const h = props.h ?? chart.height / PX_PER_INCH;
823
842
  slide.addImage({
@@ -927,7 +946,7 @@ function renderChartComponent(slide, props, theme, _pptx, warnings) {
927
946
  }
928
947
 
929
948
  // src/components/index.ts
930
- async function renderComponent(slide, component, theme, pptx, warnings, slideCtx) {
949
+ async function renderComponent(slide, component, theme, pptx, warnings, slideCtx, services) {
931
950
  if (component.enabled === false) return;
932
951
  const { name, props } = component;
933
952
  const p = props;
@@ -945,13 +964,24 @@ async function renderComponent(slide, component, theme, pptx, warnings, slideCtx
945
964
  renderTableComponent(slide, p, theme, pptx, warnings);
946
965
  break;
947
966
  case "highcharts":
948
- await renderHighchartsComponent(slide, p, theme, warnings);
967
+ await renderHighchartsComponent(
968
+ slide,
969
+ p,
970
+ theme,
971
+ warnings,
972
+ services?.highcharts
973
+ );
949
974
  break;
950
975
  case "chart":
951
976
  renderChartComponent(slide, p, theme, pptx, warnings);
952
977
  break;
953
978
  default:
954
- warn(warnings, W.UNKNOWN_COMPONENT, `Unknown PPTX component type: ${name}`, { component: name });
979
+ warn(
980
+ warnings,
981
+ W.UNKNOWN_COMPONENT,
982
+ `Unknown PPTX component type: ${name}`,
983
+ { component: name }
984
+ );
955
985
  }
956
986
  }
957
987
 
@@ -1003,10 +1033,16 @@ async function renderPresentation(processed, warnings) {
1003
1033
  headFontFace: processed.theme.fonts.heading,
1004
1034
  bodyFontFace: processed.theme.fonts.body
1005
1035
  };
1006
- const templateMap = new Map(processed.templates?.map((m) => [m.name, m]) ?? []);
1036
+ const templateMap = new Map(
1037
+ processed.templates?.map((m) => [m.name, m]) ?? []
1038
+ );
1007
1039
  if (processed.templates) {
1008
1040
  for (const templateDef of processed.templates) {
1009
- const templateProps = buildSlideTemplateProps(templateDef, processed.theme, warnings);
1041
+ const templateProps = buildSlideTemplateProps(
1042
+ templateDef,
1043
+ processed.theme,
1044
+ warnings
1045
+ );
1010
1046
  pptx.defineSlideMaster(templateProps);
1011
1047
  }
1012
1048
  }
@@ -1021,7 +1057,13 @@ async function renderPresentation(processed, warnings) {
1021
1057
  const slide = slideData.template ? pptx.addSlide({ masterName: slideData.template }) : pptx.addSlide();
1022
1058
  if (slideData.background) {
1023
1059
  if (slideData.background.color) {
1024
- slide.background = { color: resolveColor(slideData.background.color, processed.theme, warnings) };
1060
+ slide.background = {
1061
+ color: resolveColor(
1062
+ slideData.background.color,
1063
+ processed.theme,
1064
+ warnings
1065
+ )
1066
+ };
1025
1067
  } else if (slideData.background.image) {
1026
1068
  if (slideData.background.image.path) {
1027
1069
  slide.background = { path: slideData.background.image.path };
@@ -1035,12 +1077,25 @@ async function renderPresentation(processed, warnings) {
1035
1077
  }
1036
1078
  const templateDef = slideData.template ? templateMap.get(slideData.template) : void 0;
1037
1079
  if (slideData.template && !templateDef) {
1038
- warn(warnings, W.MISSING_TEMPLATE, `Unknown template "${slideData.template}". Available: ${[...templateMap.keys()].join(", ")}`, { slide: slideIdx });
1080
+ warn(
1081
+ warnings,
1082
+ W.MISSING_TEMPLATE,
1083
+ `Unknown template "${slideData.template}". Available: ${[...templateMap.keys()].join(", ")}`,
1084
+ { slide: slideIdx }
1085
+ );
1039
1086
  }
1040
1087
  const effectiveGrid = mergeGridConfigs(processed.grid, templateDef?.grid);
1041
1088
  if (templateDef?.objects) {
1042
1089
  for (const obj of templateDef.objects) {
1043
- await renderComponent(slide, obj, processed.theme, pptx, warnings, slideCtx);
1090
+ await renderComponent(
1091
+ slide,
1092
+ obj,
1093
+ processed.theme,
1094
+ pptx,
1095
+ warnings,
1096
+ slideCtx,
1097
+ processed.services
1098
+ );
1044
1099
  }
1045
1100
  }
1046
1101
  for (const component of slideData.components) {
@@ -1051,15 +1106,32 @@ async function renderPresentation(processed, warnings) {
1051
1106
  processed.slideHeight,
1052
1107
  warnings
1053
1108
  );
1054
- await renderComponent(slide, resolved, processed.theme, pptx, warnings, slideCtx);
1109
+ await renderComponent(
1110
+ slide,
1111
+ resolved,
1112
+ processed.theme,
1113
+ pptx,
1114
+ warnings,
1115
+ slideCtx,
1116
+ processed.services
1117
+ );
1055
1118
  }
1056
1119
  if (slideData.placeholders) {
1057
1120
  if (templateDef) {
1058
- const phMap = new Map(templateDef.placeholders?.map((p) => [p.name, p]) ?? []);
1059
- for (const [phName, component] of Object.entries(slideData.placeholders)) {
1121
+ const phMap = new Map(
1122
+ templateDef.placeholders?.map((p) => [p.name, p]) ?? []
1123
+ );
1124
+ for (const [phName, component] of Object.entries(
1125
+ slideData.placeholders
1126
+ )) {
1060
1127
  const phDef = phMap.get(phName);
1061
1128
  if (!phDef) {
1062
- warn(warnings, W.UNKNOWN_PLACEHOLDER, `Unknown placeholder "${phName}" in template "${slideData.template}". Available: ${[...phMap.keys()].join(", ")}`, { slide: slideIdx });
1129
+ warn(
1130
+ warnings,
1131
+ W.UNKNOWN_PLACEHOLDER,
1132
+ `Unknown placeholder "${phName}" in template "${slideData.template}". Available: ${[...phMap.keys()].join(", ")}`,
1133
+ { slide: slideIdx }
1134
+ );
1063
1135
  continue;
1064
1136
  }
1065
1137
  const gridResolved = resolveComponentGridPosition(
@@ -1074,11 +1146,25 @@ async function renderPresentation(processed, warnings) {
1074
1146
  if (phDef.y != null) posDefaults.y = phDef.y;
1075
1147
  if (phDef.w != null) posDefaults.w = phDef.w;
1076
1148
  if (phDef.h != null) posDefaults.h = phDef.h;
1077
- const props = { ...posDefaults, ...phDef.defaults?.props ?? {}, ...gridResolved.props };
1078
- await renderComponent(slide, { ...gridResolved, props }, processed.theme, pptx, warnings, slideCtx);
1149
+ const props = {
1150
+ ...posDefaults,
1151
+ ...phDef.defaults?.props ?? {},
1152
+ ...gridResolved.props
1153
+ };
1154
+ await renderComponent(
1155
+ slide,
1156
+ { ...gridResolved, props },
1157
+ processed.theme,
1158
+ pptx,
1159
+ warnings,
1160
+ slideCtx,
1161
+ processed.services
1162
+ );
1079
1163
  }
1080
1164
  } else {
1081
- for (const [phName, component] of Object.entries(slideData.placeholders)) {
1165
+ for (const [phName, component] of Object.entries(
1166
+ slideData.placeholders
1167
+ )) {
1082
1168
  const hasPosition = component.props.x != null || component.props.y != null || component.props.grid;
1083
1169
  if (hasPosition) {
1084
1170
  const resolved = resolveComponentGridPosition(
@@ -1088,9 +1174,22 @@ async function renderPresentation(processed, warnings) {
1088
1174
  processed.slideHeight,
1089
1175
  warnings
1090
1176
  );
1091
- await renderComponent(slide, resolved, processed.theme, pptx, warnings, slideCtx);
1177
+ await renderComponent(
1178
+ slide,
1179
+ resolved,
1180
+ processed.theme,
1181
+ pptx,
1182
+ warnings,
1183
+ slideCtx,
1184
+ processed.services
1185
+ );
1092
1186
  } else {
1093
- warn(warnings, W.PLACEHOLDER_NO_POSITION, `Placeholder "${phName}" has no template and no explicit position \u2014 skipped`, { slide: slideIdx });
1187
+ warn(
1188
+ warnings,
1189
+ W.PLACEHOLDER_NO_POSITION,
1190
+ `Placeholder "${phName}" has no template and no explicit position \u2014 skipped`,
1191
+ { slide: slideIdx }
1192
+ );
1094
1193
  }
1095
1194
  }
1096
1195
  }
@@ -1413,7 +1512,8 @@ function createBuilderImpl(state) {
1413
1512
  componentNames: newComponentNames,
1414
1513
  theme: state.theme,
1415
1514
  customThemes: state.customThemes,
1416
- debug: state.debug
1515
+ debug: state.debug,
1516
+ services: state.services
1417
1517
  };
1418
1518
  return createBuilderImpl(
1419
1519
  newState
@@ -1438,7 +1538,8 @@ function createBuilderImpl(state) {
1438
1538
  children: processedChildren
1439
1539
  };
1440
1540
  const processed = processPresentation(processedDocument, {
1441
- customThemes: state.customThemes
1541
+ customThemes: state.customThemes,
1542
+ services: state.services
1442
1543
  });
1443
1544
  const pptx = await renderPresentation(processed, warnings);
1444
1545
  const data = await pptx.write({ outputType: "nodebuffer" });
@@ -1548,7 +1649,8 @@ function createPresentationGenerator(options = {}) {
1548
1649
  componentNames: /* @__PURE__ */ new Set(),
1549
1650
  theme: options.theme,
1550
1651
  customThemes: options.customThemes,
1551
- debug: options.debug ?? false
1652
+ debug: options.debug ?? false,
1653
+ services: options.services
1552
1654
  };
1553
1655
  return createBuilderImpl(initialState);
1554
1656
  }