pptx-kit-preview 0.3.0 → 0.3.1

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.
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Resvg } from '@resvg/resvg-js';
2
- import { getSlideSize, getPresentationTheme, getEffectiveColorMap, getSlideBackground, getSlideLayout, getSlideLayoutBackground, getSlideMasterBackground, getSlideBackgroundGradientFill, getSlideLayoutBackgroundGradientFill, getSlideMasterBackgroundGradientFill, getSlideBackgroundPatternFill, getSlideLayoutBackgroundPatternFill, getSlideMasterBackgroundPatternFill, getSlideBackgroundImageBytes, getSlideLayoutBackgroundImageBytes, getSlideMasterBackgroundImageBytes, getSlideMasterShapes, getSlideLayoutShapes, getSlideShapes, getShapeBoundsResolved, getShapeKind, getShapeFillEffective, getShapeStrokeEffective, getShapeRotation, getShapeFlip, getShapePlaceholderType, getShapeImageFormat, getShapeImageBytes, getShapeImageFillBytes, getShapePreset, getGroupTransform, getGroupChildren, isChartShape, isTableShape, getTableDimensions, getShapeCustomGeometry, getShapeXmlString, getShapeAdjustValues, getShapeHyperlink, getShapeHyperlinkTooltip, getShapeName, getShapeAltTitle, getShapeDescription, getShapeClickAction, getSlideIndex, getShapeParagraphCount, getPresentationFonts, getShapeBodyPrEffective, getShapeTextMargins, getShapeTextDirection, getShapeTextAnchor, isShapePlaceholder, isShapeTextBox, getParagraphPropertiesEffective, getParagraphLevel, getParagraphAlignment, getParagraphBullet, getParagraphBulletStyle, isParagraphBulletPicture, getParagraphBulletImageBytes, getParagraphSpacing, getParagraphIndent, getShapeParagraphElements, getShapeRunFormatEffective, getShapeRunFormat, getShapeRunHyperlink, getShapeRunClickAction, getShapeRunHyperlinkTooltip, getShapeTextAutoFitParams, getShapeTextColumns, getShapeTextBodyRotationDeg, getShapeImagePartName, getShapeImageCrop, getShapeImageBrightness, getShapeImageContrast, getShapeImageOpacity, isShapeImageGrayscale, getShapeImageBiLevelThreshold, getShapeImageDuotone, getShapeImageLinkUrl, getShapeFillColorResolved, getShapeGradientFillEffective, getShapeGradientFill, getShapePatternFill, getShapeStrokeColorResolved, getShapeStrokeDash, getShapeStrokeCap, getShapeStrokeJoin, getShapeStrokeCompound, getShapeStrokeArrow, getShapeChartSpec, getTableColumnWidths, getTableRowHeights, getTableCells, getTableStyleFlags, getTableCellSpan, getTableCellFill, getTableCellBorders, getTableCellParagraphs, getTableCellAnchor, getTableCellMargins, getShapeEffectsEffective } from 'pptx-kit';
2
+ import { getSlideSize, getPresentationTheme, getEffectiveColorMap, resolveDeckBodyTextColor, getSlideBackground, getSlideLayout, getSlideLayoutBackground, getSlideMasterBackground, getSlideBackgroundGradientFill, getSlideLayoutBackgroundGradientFill, getSlideMasterBackgroundGradientFill, getSlideBackgroundPatternFill, getSlideLayoutBackgroundPatternFill, getSlideMasterBackgroundPatternFill, getSlideBackgroundImageBytes, getSlideLayoutBackgroundImageBytes, getSlideMasterBackgroundImageBytes, getSlideMasterShapes, getSlideLayoutShapes, getSlideShapes, getShapeBoundsResolved, getShapeKind, getShapeFillEffective, getShapeStrokeEffective, getShapeRotation, getShapeFlip, getShapePlaceholderType, getShapeImageFormat, getShapeImageBytes, getShapeImageFillBytes, getShapePreset, getGroupTransform, getGroupChildren, isChartShape, isTableShape, getTableDimensions, getShapeCustomGeometry, getShapeXmlString, getShapeAdjustValues, getShapeHyperlink, getShapeHyperlinkTooltip, getShapeName, getShapeAltTitle, getShapeDescription, getShapeClickAction, getSlideIndex, getShapeParagraphCount, getPresentationFonts, getShapeBodyPrEffective, getShapeTextMargins, getShapeTextDirection, getShapeTextAnchor, isShapePlaceholder, isShapeTextBox, getParagraphPropertiesEffective, getParagraphLevel, getParagraphAlignment, getParagraphBullet, getParagraphBulletStyle, isParagraphBulletPicture, getParagraphBulletImageBytes, getParagraphSpacing, getParagraphIndent, getShapeParagraphElements, getShapeRunFormatEffective, getShapeRunFormat, getShapeRunHyperlink, getShapeRunClickAction, getShapeRunHyperlinkTooltip, getShapeTextAutoFitParams, getShapeTextColumns, getShapeTextBodyRotationDeg, getShapeImagePartName, getShapeImageCrop, getShapeImageBrightness, getShapeImageContrast, getShapeImageOpacity, isShapeImageGrayscale, getShapeImageBiLevelThreshold, getShapeImageDuotone, getShapeImageLinkUrl, getShapeFillColorResolved, getShapeGradientFillEffective, getShapeGradientFill, getShapePatternFill, getShapeStrokeColorResolved, getShapeStrokeDash, getShapeStrokeCap, getShapeStrokeJoin, getShapeStrokeCompound, getShapeStrokeArrow, getShapeChartSpec, getTableColumnWidths, getTableRowHeights, getTableCells, getTableStyleFlags, getTableCellSpan, getTableCellFill, getTableCellBorders, getTableCellParagraphs, getTableCellAnchor, getTableCellMargins, getShapeEffectsEffective } from 'pptx-kit';
3
3
  import * as fontkit from 'fontkit';
4
4
  import { existsSync, readFileSync } from 'fs';
5
5
  import { fileURLToPath } from 'url';
@@ -564,6 +564,7 @@ var resolveColor = (c, theme, fallback = "#1F2937") => {
564
564
  var nextDefId = 0;
565
565
  var mintId = () => `pkdef-${(nextDefId++).toString(36)}`;
566
566
  var activeColorMap = null;
567
+ var activeDeckTextColor = "#000000";
567
568
  var gradientDef = (grad, theme) => {
568
569
  const id = mintId();
569
570
  const stops = grad.stops.map(
@@ -2325,7 +2326,7 @@ var renderTextBody = (pres, shape, bounds, theme, phType, ctx) => {
2325
2326
  );
2326
2327
  }
2327
2328
  const justify = ANCHOR_TO_CSS[anchor] ?? "flex-start";
2328
- const defaultColor = resolveColor("scheme:tx1", theme, "#000000");
2329
+ const defaultColor = activeDeckTextColor;
2329
2330
  if (ctx.mode === "svg") {
2330
2331
  const svgScale = authoredAutofit?.fontScale ?? 1;
2331
2332
  const svgLineScale = 1 - (authoredAutofit?.lnSpcReduction ?? 0);
@@ -3883,7 +3884,7 @@ var renderTable = (shape, pres, x, y, w, h, transform, theme, ctx) => {
3883
3884
  const accent = theme ? normalizeHex(theme.accent1) : "#4472C4";
3884
3885
  const headerFill = accent;
3885
3886
  const bandFill = mixHex(accent, "#FFFFFF", 0.92);
3886
- const textColor = resolveColor("scheme:tx1", theme, "#000000");
3887
+ const textColor = activeDeckTextColor;
3887
3888
  const tableThemeFace = getPresentationFonts(pres)?.minorLatin ?? null;
3888
3889
  const out = [];
3889
3890
  out.push(`<g${transform}>`);
@@ -4463,6 +4464,7 @@ var renderSlideSvg = (pres, slide, opts = {}) => {
4463
4464
  const H = size.height;
4464
4465
  const theme = getPresentationTheme(pres);
4465
4466
  activeColorMap = getEffectiveColorMap(slide);
4467
+ activeDeckTextColor = resolveDeckBodyTextColor(slide) ?? "#000000";
4466
4468
  const ctx = {
4467
4469
  mode: opts.textLayout ?? "foreignObject",
4468
4470
  measure: opts.measureText ?? defaultMeasurer