@json-to-office/core-pptx 0.8.4 → 0.9.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.
@@ -25,6 +25,7 @@ interface ShapeComponentProps {
25
25
  fontColor?: string;
26
26
  charSpacing?: number;
27
27
  bold?: boolean;
28
+ fontWeight?: number;
28
29
  italic?: boolean;
29
30
  align?: string;
30
31
  valign?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../src/components/shape.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI/D,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAA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ean;
13
+ fontWeight?: number;
13
14
  italic?: boolean;
14
15
  align?: string;
15
16
  valign?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/components/table.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAajE,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC5B;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,CAAC;IAC/B,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,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TextComponentProps {
13
13
  fontFace?: string;
14
14
  color?: string;
15
15
  bold?: boolean;
16
+ fontWeight?: number;
16
17
  italic?: boolean;
17
18
  underline?: boolean | {
18
19
  style?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components/text.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG1F,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvE,MAAM,CAAC,EAAE,MAAM,GAAG,M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AChD,SAAS,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAaD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,KAAK,EAAE,kBAAkB,EACzB,KAAK,EAAE,eAAe,EACtB,QAAQ,CAAC,EAAE,eAAe,EAAE,EAC5B,QAAQ,CAAC,EAAE,YAAY,GACtB,IAAI,CAiIN"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Shared font-resolution helper used by BOTH entry paths into renderPresentation:
3
+ *
4
+ * - core/generator.ts → generateBufferWithWarnings (non-plugin)
5
+ * - plugin/createPresentationGenerator.ts → generate (plugin-aware)
6
+ *
7
+ * Keeping it in one place ensures both paths validate, materialize, and fire
8
+ * the `onResolved` side-channel consumed by the LibreOffice preview stager.
9
+ */
10
+ import type { FontRuntimeOpts, ResolvedFont } from '@json-to-office/shared';
11
+ import type { PipelineWarning, PresentationComponentDefinition } from '../types';
12
+ import type { PptxThemeConfig } from '../types';
13
+ export declare function resolveDocumentFonts(document: PresentationComponentDefinition, theme: PptxThemeConfig, warnings: PipelineWarning[], fonts?: FontRuntimeOpts): Promise<ResolvedFont[]>;
14
+ //# sourceMappingURL=fontResolution.d.ts.map
@@ -0,0 +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;AAW5E,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,CAsDzB"}
@@ -5,13 +5,14 @@
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
+ import type { ServicesConfig, FontRuntimeOpts } from '@json-to-office/shared';
9
9
  /**
10
10
  * Options for the generation pipeline
11
11
  */
12
12
  export interface GenerationOptions {
13
13
  customThemes?: Record<string, PptxThemeConfig>;
14
14
  services?: ServicesConfig;
15
+ fonts?: FontRuntimeOpts;
15
16
  }
16
17
  /**
17
18
  * 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,EACV,+BAA+B,EAC/B,eAAe,EACf,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,w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I,EAAE,SAAS,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;CAQjC,CAAC"}
package/dist/index.js CHANGED
@@ -26,7 +26,8 @@ var W = {
26
26
  THEME_COLOR_FALLBACK: "THEME_COLOR_FALLBACK",
27
27
  UNKNOWN_COLOR: "UNKNOWN_COLOR",
28
28
  GRID_POSITION_CLAMPED: "GRID_POSITION_CLAMPED",
29
- IMAGE_ZERO_BOX: "IMAGE_ZERO_BOX"
29
+ IMAGE_ZERO_BOX: "IMAGE_ZERO_BOX",
30
+ FONT_UNRESOLVED: "FONT_UNRESOLVED"
30
31
  };
31
32
  function warn(warnings, code, message, extra) {
32
33
  if (warnings) {
@@ -429,6 +430,25 @@ function resolveColor(color, theme, warnings) {
429
430
  return bare;
430
431
  }
431
432
 
433
+ // src/utils/fontAliasContext.ts
434
+ import { synthesizeFamilyName } from "@json-to-office/shared";
435
+ function applyFontWeight(params) {
436
+ if (!params.family) {
437
+ const weight2 = params.fontWeight ?? (params.bold === true ? 700 : void 0);
438
+ return {
439
+ bold: weight2 != null ? weight2 >= 600 : params.bold,
440
+ italic: params.italic
441
+ };
442
+ }
443
+ const weight = params.fontWeight ?? (params.bold === true ? 700 : void 0);
444
+ const synth = synthesizeFamilyName(
445
+ params.family,
446
+ weight,
447
+ params.italic === true
448
+ );
449
+ return { fontFace: synth.family, bold: synth.bold, italic: synth.italic };
450
+ }
451
+
432
452
  // src/components/text.ts
433
453
  function resolvePagePlaceholders(text, ctx) {
434
454
  const { slideNumber, totalSlides, pageNumberFormat } = ctx;
@@ -451,11 +471,27 @@ function renderTextComponent(slide, props, theme, warnings, slideCtx) {
451
471
  }
452
472
  opts.fontSize = props.fontSize ?? style?.fontSize ?? theme.defaults.fontSize;
453
473
  opts.fontFace = props.fontFace ?? style?.fontFace ?? (isHeadingStyle ? theme.fonts.heading : theme.fonts.body);
454
- opts.color = resolveColor(props.color ?? style?.fontColor ?? theme.defaults.fontColor, theme, warnings);
474
+ opts.color = resolveColor(
475
+ props.color ?? style?.fontColor ?? theme.defaults.fontColor,
476
+ theme,
477
+ warnings
478
+ );
455
479
  const bold = props.bold ?? style?.bold;
456
480
  const italic = props.italic ?? style?.italic;
481
+ const fontWeight = props.fontWeight ?? style?.fontWeight;
457
482
  if (bold != null) opts.bold = bold;
458
483
  if (italic != null) opts.italic = italic;
484
+ if (fontWeight != null || bold === true) {
485
+ const w = applyFontWeight({
486
+ family: opts.fontFace,
487
+ fontWeight,
488
+ italic,
489
+ bold
490
+ });
491
+ if (w.fontFace !== void 0) opts.fontFace = w.fontFace;
492
+ if (w.bold !== void 0) opts.bold = w.bold;
493
+ if (w.italic !== void 0) opts.italic = w.italic;
494
+ }
459
495
  if (props.strike) opts.strike = true;
460
496
  if (props.underline !== void 0) {
461
497
  if (typeof props.underline === "boolean") {
@@ -503,7 +539,8 @@ function renderTextComponent(slide, props, theme, warnings, slideCtx) {
503
539
  if (lineSpacing !== void 0) opts.lineSpacing = lineSpacing;
504
540
  const charSpacing = props.charSpacing ?? style?.charSpacing;
505
541
  if (charSpacing !== void 0) opts.charSpacing = charSpacing;
506
- if (props.paraSpaceBefore !== void 0) opts.paraSpaceBefore = props.paraSpaceBefore;
542
+ if (props.paraSpaceBefore !== void 0)
543
+ opts.paraSpaceBefore = props.paraSpaceBefore;
507
544
  const paraSpaceAfter = props.paraSpaceAfter ?? style?.paraSpaceAfter;
508
545
  if (paraSpaceAfter !== void 0) opts.paraSpaceAfter = paraSpaceAfter;
509
546
  if (props.breakLine) opts.breakLine = true;
@@ -710,9 +747,16 @@ function buildShapeOpts(props, theme, warnings) {
710
747
  }
711
748
  if (props.line) {
712
749
  opts.line = {};
713
- if (props.line.color) opts.line.color = resolveColor(props.line.color, theme, warnings);
714
- if (props.line.width) opts.line.width = props.line.width;
715
- if (props.line.dashType) opts.line.dashType = props.line.dashType;
750
+ if (props.line.color)
751
+ opts.line.color = resolveColor(
752
+ props.line.color,
753
+ theme,
754
+ warnings
755
+ );
756
+ if (props.line.width)
757
+ opts.line.width = props.line.width;
758
+ if (props.line.dashType)
759
+ opts.line.dashType = props.line.dashType;
716
760
  }
717
761
  if (props.rotate !== void 0) opts.rotate = props.rotate;
718
762
  if (props.rectRadius !== void 0) opts.rectRadius = props.rectRadius;
@@ -732,7 +776,9 @@ function renderShapeComponent(slide, props, theme, pptx, warnings) {
732
776
  const shapeTypeName = SHAPE_TYPE_MAP[props.type] || props.type;
733
777
  const shapeType = pptx.ShapeType[shapeTypeName];
734
778
  if (!shapeType) {
735
- warn(warnings, W.UNKNOWN_SHAPE, `Unknown shape type: ${props.type}`, { component: "shape" });
779
+ warn(warnings, W.UNKNOWN_SHAPE, `Unknown shape type: ${props.type}`, {
780
+ component: "shape"
781
+ });
736
782
  return;
737
783
  }
738
784
  const style = props.style ? theme.styles?.[props.style] : void 0;
@@ -742,32 +788,69 @@ function renderShapeComponent(slide, props, theme, pptx, warnings) {
742
788
  opts.shape = shapeType;
743
789
  opts.fontSize = props.fontSize ?? style?.fontSize ?? theme.defaults.fontSize;
744
790
  opts.fontFace = props.fontFace ?? style?.fontFace ?? (isHeadingStyle ? theme.fonts.heading : theme.fonts.body);
745
- opts.color = resolveColor(props.fontColor ?? style?.fontColor ?? theme.defaults.fontColor, theme, warnings);
791
+ const preAliasFamily = opts.fontFace;
792
+ opts.color = resolveColor(
793
+ props.fontColor ?? style?.fontColor ?? theme.defaults.fontColor,
794
+ theme,
795
+ warnings
796
+ );
746
797
  const bold = props.bold ?? style?.bold;
747
798
  const italic = props.italic ?? style?.italic;
748
- if (bold != null) opts.bold = bold;
749
- if (italic != null) opts.italic = italic;
799
+ const fontWeight = props.fontWeight ?? style?.fontWeight;
750
800
  const charSpacing = props.charSpacing ?? style?.charSpacing;
751
801
  if (charSpacing !== void 0) opts.charSpacing = charSpacing;
752
802
  const align = props.align ?? style?.align;
753
803
  if (align) opts.align = align;
754
804
  opts.valign = props.valign ?? "top";
755
805
  if (Array.isArray(props.text)) {
806
+ if (bold != null) opts.bold = bold;
807
+ if (italic != null) opts.italic = italic;
756
808
  const textSegments = props.text.map((seg) => {
757
809
  const segOpts = {};
758
810
  if (seg.fontSize != null) segOpts.fontSize = seg.fontSize;
759
811
  if (seg.fontFace != null) segOpts.fontFace = seg.fontFace;
760
- if (seg.color != null) segOpts.color = resolveColor(seg.color, theme, warnings);
761
- if (seg.bold != null) segOpts.bold = seg.bold;
762
- if (seg.italic != null) segOpts.italic = seg.italic;
812
+ if (seg.color != null)
813
+ segOpts.color = resolveColor(seg.color, theme, warnings);
763
814
  if (seg.breakLine != null) segOpts.breakLine = seg.breakLine;
764
815
  if (seg.charSpacing != null) segOpts.charSpacing = seg.charSpacing;
765
816
  if (seg.spaceBefore != null) segOpts.paraSpaceBefore = seg.spaceBefore;
766
817
  if (seg.spaceAfter != null) segOpts.paraSpaceAfter = seg.spaceAfter;
818
+ const segWeight = seg.fontWeight;
819
+ const effWeight = segWeight ?? fontWeight;
820
+ const effBold = seg.bold ?? bold;
821
+ const effItalic = seg.italic ?? italic;
822
+ if (effBold != null) segOpts.bold = effBold;
823
+ if (effItalic != null) segOpts.italic = effItalic;
824
+ if (effWeight != null || effBold === true) {
825
+ if (seg.fontFace == null) {
826
+ const w = applyFontWeight({
827
+ family: preAliasFamily,
828
+ fontWeight: effWeight,
829
+ italic: effItalic,
830
+ bold: effBold
831
+ });
832
+ if (w.fontFace !== void 0) segOpts.fontFace = w.fontFace;
833
+ if (w.bold !== void 0) segOpts.bold = w.bold;
834
+ if (w.italic !== void 0) segOpts.italic = w.italic;
835
+ }
836
+ }
767
837
  return { text: seg.text, options: segOpts };
768
838
  });
769
839
  slide.addText(textSegments, opts);
770
840
  } else {
841
+ if (bold != null) opts.bold = bold;
842
+ if (italic != null) opts.italic = italic;
843
+ if (fontWeight != null || bold === true) {
844
+ const w = applyFontWeight({
845
+ family: preAliasFamily,
846
+ fontWeight,
847
+ italic,
848
+ bold
849
+ });
850
+ if (w.fontFace !== void 0) opts.fontFace = w.fontFace;
851
+ if (w.bold !== void 0) opts.bold = w.bold;
852
+ if (w.italic !== void 0) opts.italic = w.italic;
853
+ }
771
854
  slide.addText(props.text, opts);
772
855
  }
773
856
  } else {
@@ -830,14 +913,19 @@ function renderTableComponent(slide, props, theme, pptx, warnings) {
830
913
  return { text: applyTextVariationSelector(cell), options: opts2 };
831
914
  }
832
915
  const cellOpts = {};
833
- if (cell.color) cellOpts.color = resolveColor(cell.color, theme, warnings);
916
+ if (cell.color)
917
+ cellOpts.color = resolveColor(cell.color, theme, warnings);
834
918
  if (bgFill) {
835
919
  const isHeader = rowIndex === 0;
836
920
  if (!isCorner) {
837
921
  const resolvedFill = cell.fill ? resolveColor(cell.fill, theme, warnings) : isHeader ? headerFill : bgFill;
838
922
  cellOpts.fill = { color: resolvedFill };
839
923
  }
840
- cellOpts.border = buildBorderRadiusBorders(rowIndex, colIndex, row.length);
924
+ cellOpts.border = buildBorderRadiusBorders(
925
+ rowIndex,
926
+ colIndex,
927
+ row.length
928
+ );
841
929
  } else if (cell.fill) {
842
930
  cellOpts.fill = { color: resolveColor(cell.fill, theme, warnings) };
843
931
  }
@@ -845,6 +933,17 @@ function renderTableComponent(slide, props, theme, pptx, warnings) {
845
933
  if (cell.fontFace) cellOpts.fontFace = cell.fontFace;
846
934
  if (cell.bold) cellOpts.bold = true;
847
935
  if (cell.italic) cellOpts.italic = true;
936
+ if (cell.fontWeight != null || cell.bold === true) {
937
+ const w = applyFontWeight({
938
+ family: cellOpts.fontFace ?? props.fontFace ?? theme.fonts.body,
939
+ fontWeight: cell.fontWeight,
940
+ italic: cell.italic,
941
+ bold: cell.bold
942
+ });
943
+ if (w.fontFace !== void 0) cellOpts.fontFace = w.fontFace;
944
+ if (w.bold !== void 0) cellOpts.bold = w.bold;
945
+ if (w.italic !== void 0) cellOpts.italic = w.italic;
946
+ }
848
947
  if (cell.align) cellOpts.align = cell.align;
849
948
  if (cell.valign) cellOpts.valign = cell.valign;
850
949
  if (cell.colspan) cellOpts.colspan = cell.colspan;
@@ -867,7 +966,8 @@ function renderTableComponent(slide, props, theme, pptx, warnings) {
867
966
  color: resolveColor(props.border.color ?? "000000", theme, warnings)
868
967
  };
869
968
  }
870
- if (props.fill) opts.fill = { color: resolveColor(props.fill, theme, warnings) };
969
+ if (props.fill)
970
+ opts.fill = { color: resolveColor(props.fill, theme, warnings) };
871
971
  opts.fontSize = props.fontSize ?? theme.defaults.fontSize;
872
972
  opts.fontFace = props.fontFace ?? theme.fonts.body;
873
973
  if (props.color) opts.color = resolveColor(props.color, theme, warnings);
@@ -928,7 +1028,12 @@ function renderTableComponent(slide, props, theme, pptx, warnings) {
928
1028
  }
929
1029
  if (bgFill && borderRadiusTableW !== void 0) {
930
1030
  opts.w = borderRadiusTableW;
931
- opts.border = [{ type: "none" }, { type: "none" }, { type: "none" }, { type: "none" }];
1031
+ opts.border = [
1032
+ { type: "none" },
1033
+ { type: "none" },
1034
+ { type: "none" },
1035
+ { type: "none" }
1036
+ ];
932
1037
  }
933
1038
  slide.addTable(tableRows, opts);
934
1039
  }
@@ -1368,7 +1473,60 @@ async function renderPresentation(processed, warnings) {
1368
1473
  return pptx;
1369
1474
  }
1370
1475
 
1476
+ // src/core/fontResolution.ts
1477
+ import {
1478
+ collectFontNamesFromPptx,
1479
+ validateFontReferences,
1480
+ FontRegistry
1481
+ } from "@json-to-office/shared";
1482
+ import {
1483
+ loadFileFontSource,
1484
+ FontDiskCache,
1485
+ fetchVariableFontSource
1486
+ } from "@json-to-office/shared/fonts/node";
1487
+ async function resolveDocumentFonts(document, theme, warnings, fonts) {
1488
+ const names = /* @__PURE__ */ new Set();
1489
+ for (const n of collectFontNamesFromPptx(document)) names.add(n);
1490
+ for (const n of collectFontNamesFromPptx(theme)) names.add(n);
1491
+ if (names.size === 0) return [];
1492
+ const validation = validateFontReferences({
1493
+ referencedNames: names,
1494
+ registeredEntries: fonts?.extraEntries
1495
+ });
1496
+ if (validation.warnings.length > 0) {
1497
+ if (fonts?.strict) {
1498
+ throw new Error(
1499
+ `Unresolved font references (strict mode):
1500
+ ` + validation.warnings.map((w) => ` - ${w.message}`).join("\n")
1501
+ );
1502
+ }
1503
+ for (const w of validation.warnings) {
1504
+ warn(warnings, W.FONT_UNRESOLVED, w.message, {
1505
+ component: "fontRegistry"
1506
+ });
1507
+ }
1508
+ }
1509
+ if (!fonts?.onResolved) return [];
1510
+ const registry = new FontRegistry({
1511
+ opts: fonts,
1512
+ fileLoader: loadFileFontSource,
1513
+ variableLoader: fetchVariableFontSource,
1514
+ diskCache: fonts?.googleFonts?.cacheDir ? new FontDiskCache(fonts.googleFonts.cacheDir) : void 0
1515
+ });
1516
+ const resolved = await registry.resolveMany(names);
1517
+ for (const r of resolved) {
1518
+ for (const msg of r.warnings) {
1519
+ warn(warnings, W.FONT_UNRESOLVED, msg, {
1520
+ component: "fontRegistry"
1521
+ });
1522
+ }
1523
+ }
1524
+ fonts.onResolved(resolved);
1525
+ return resolved;
1526
+ }
1527
+
1371
1528
  // src/core/generator.ts
1529
+ import { applyExportMode, scopedThemeName } from "@json-to-office/shared";
1372
1530
  function isPresentationComponentDefinition(definition) {
1373
1531
  if (typeof definition !== "object" || definition === null) return false;
1374
1532
  const def = definition;
@@ -1397,7 +1555,47 @@ async function generateBufferWithWarnings(jsonConfig, options) {
1397
1555
  component = jsonConfig;
1398
1556
  }
1399
1557
  const warnings = [];
1400
- const pptx = await generatePresentation(component, options, warnings);
1558
+ const baseThemeName = component.props?.theme ?? "default";
1559
+ let resolvedTheme = options?.customThemes?.[baseThemeName] ?? getPptxTheme(baseThemeName);
1560
+ const mode = applyExportMode({
1561
+ doc: component,
1562
+ theme: resolvedTheme,
1563
+ fonts: options?.fonts
1564
+ });
1565
+ component = mode.doc;
1566
+ resolvedTheme = mode.theme;
1567
+ for (const w of mode.warnings) {
1568
+ warnings.push({
1569
+ code: w.code,
1570
+ message: w.message,
1571
+ component: "fontRegistry"
1572
+ });
1573
+ }
1574
+ await resolveDocumentFonts(
1575
+ component,
1576
+ resolvedTheme,
1577
+ warnings,
1578
+ options?.fonts
1579
+ );
1580
+ const themeName = scopedThemeName(baseThemeName, options?.fonts?.mode);
1581
+ if (themeName !== baseThemeName) {
1582
+ component = {
1583
+ ...component,
1584
+ props: { ...component.props, theme: themeName }
1585
+ };
1586
+ }
1587
+ const effectiveOptions = {
1588
+ ...options,
1589
+ customThemes: {
1590
+ ...options?.customThemes ?? {},
1591
+ [themeName]: resolvedTheme
1592
+ }
1593
+ };
1594
+ const pptx = await generatePresentation(
1595
+ component,
1596
+ effectiveOptions,
1597
+ warnings
1598
+ );
1401
1599
  const data = await pptx.write({ outputType: "nodebuffer" });
1402
1600
  const buffer = await neutralizeTableStyle(data);
1403
1601
  return { buffer, warnings };
@@ -1557,6 +1755,7 @@ async function exportPluginSchema(customComponents, outputPath, options = {}) {
1557
1755
  }
1558
1756
 
1559
1757
  // src/plugin/createPresentationGenerator.ts
1758
+ import { applyExportMode as applyExportMode2, scopedThemeName as scopedThemeName2 } from "@json-to-office/shared";
1560
1759
  var MEDIUM_STYLE_2_ACCENT_12 = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}";
1561
1760
  var NO_STYLE_NO_GRID2 = "{2D5ABB26-0587-4C30-8999-92F81FD0307C}";
1562
1761
  async function neutralizeTableStyle2(buffer) {
@@ -1680,7 +1879,8 @@ function createBuilderImpl(state) {
1680
1879
  theme: state.theme,
1681
1880
  customThemes: state.customThemes,
1682
1881
  debug: state.debug,
1683
- services: state.services
1882
+ services: state.services,
1883
+ fonts: state.fonts
1684
1884
  };
1685
1885
  return createBuilderImpl(
1686
1886
  newState
@@ -1692,20 +1892,42 @@ function createBuilderImpl(state) {
1692
1892
  if (!internalDocument || internalDocument.name !== "pptx") {
1693
1893
  throw new Error("Top-level component must be a pptx component");
1694
1894
  }
1695
- const themeName = typeof state.theme === "string" ? state.theme : internalDocument.props.theme ?? "default";
1696
- const resolvedTheme = typeof state.theme === "object" ? state.theme : state.customThemes?.[themeName] ?? getPptxTheme(themeName);
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);
1697
1897
  const warnings = [];
1698
- const processedChildren = internalDocument.children ? await processAllSlides(
1699
- internalDocument.children,
1700
- warnings,
1701
- resolvedTheme
1702
- ) : [];
1703
- const processedDocument = {
1704
- ...internalDocument,
1898
+ const mode = applyExportMode2({
1899
+ doc: internalDocument,
1900
+ theme: resolvedTheme,
1901
+ fonts: state.fonts
1902
+ });
1903
+ resolvedTheme = mode.theme;
1904
+ for (const w of mode.warnings) {
1905
+ warnings.push({
1906
+ code: w.code,
1907
+ message: w.message,
1908
+ component: "fontRegistry"
1909
+ });
1910
+ }
1911
+ const processedChildren = mode.doc.children ? await processAllSlides(mode.doc.children, warnings, resolvedTheme) : [];
1912
+ const themeName = scopedThemeName2(baseThemeName, state.fonts?.mode);
1913
+ const docWithScopedTheme = themeName !== baseThemeName ? {
1914
+ ...mode.doc,
1915
+ props: { ...mode.doc.props, theme: themeName },
1705
1916
  children: processedChildren
1917
+ } : { ...mode.doc, children: processedChildren };
1918
+ const processedDocument = docWithScopedTheme;
1919
+ await resolveDocumentFonts(
1920
+ processedDocument,
1921
+ resolvedTheme,
1922
+ warnings,
1923
+ state.fonts
1924
+ );
1925
+ const effectiveCustomThemes = {
1926
+ ...state.customThemes ?? {},
1927
+ [themeName]: resolvedTheme
1706
1928
  };
1707
1929
  const processed = processPresentation(processedDocument, {
1708
- customThemes: state.customThemes,
1930
+ customThemes: effectiveCustomThemes,
1709
1931
  services: state.services
1710
1932
  });
1711
1933
  const pptx = await renderPresentation(processed, warnings);
@@ -1817,7 +2039,8 @@ function createPresentationGenerator(options = {}) {
1817
2039
  theme: options.theme,
1818
2040
  customThemes: options.customThemes,
1819
2041
  debug: options.debug ?? false,
1820
- services: options.services
2042
+ services: options.services,
2043
+ fonts: options.fonts
1821
2044
  };
1822
2045
  return createBuilderImpl(initialState);
1823
2046
  }