pptx-kit-preview 0.2.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/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/node.js +9 -4
- package/dist/node.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getSlideSize, getPresentationTheme, 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';
|
|
1
|
+
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';
|
|
2
2
|
|
|
3
3
|
// src/render-slide.ts
|
|
4
4
|
|
|
@@ -545,7 +545,8 @@ var resolveColor = (c, theme, fallback = "#1F2937") => {
|
|
|
545
545
|
else if (SCHEME_TO_THEME[c]) token = c;
|
|
546
546
|
if (token !== null) {
|
|
547
547
|
if (theme) {
|
|
548
|
-
const
|
|
548
|
+
const mapped = activeColorMap?.[token] ?? token;
|
|
549
|
+
const key = SCHEME_TO_THEME[mapped] ?? SCHEME_TO_THEME[token];
|
|
549
550
|
if (key) return normalizeHex(theme[key]);
|
|
550
551
|
}
|
|
551
552
|
if (token === "tx1" || token === "dk1") return "#000000";
|
|
@@ -558,6 +559,8 @@ var resolveColor = (c, theme, fallback = "#1F2937") => {
|
|
|
558
559
|
};
|
|
559
560
|
var nextDefId = 0;
|
|
560
561
|
var mintId = () => `pkdef-${(nextDefId++).toString(36)}`;
|
|
562
|
+
var activeColorMap = null;
|
|
563
|
+
var activeDeckTextColor = "#000000";
|
|
561
564
|
var gradientDef = (grad, theme) => {
|
|
562
565
|
const id = mintId();
|
|
563
566
|
const stops = grad.stops.map(
|
|
@@ -2319,7 +2322,7 @@ var renderTextBody = (pres, shape, bounds, theme, phType, ctx) => {
|
|
|
2319
2322
|
);
|
|
2320
2323
|
}
|
|
2321
2324
|
const justify = ANCHOR_TO_CSS[anchor] ?? "flex-start";
|
|
2322
|
-
const defaultColor =
|
|
2325
|
+
const defaultColor = activeDeckTextColor;
|
|
2323
2326
|
if (ctx.mode === "svg") {
|
|
2324
2327
|
const svgScale = authoredAutofit?.fontScale ?? 1;
|
|
2325
2328
|
const svgLineScale = 1 - (authoredAutofit?.lnSpcReduction ?? 0);
|
|
@@ -3877,7 +3880,7 @@ var renderTable = (shape, pres, x, y, w, h, transform, theme, ctx) => {
|
|
|
3877
3880
|
const accent = theme ? normalizeHex(theme.accent1) : "#4472C4";
|
|
3878
3881
|
const headerFill = accent;
|
|
3879
3882
|
const bandFill = mixHex(accent, "#FFFFFF", 0.92);
|
|
3880
|
-
const textColor =
|
|
3883
|
+
const textColor = activeDeckTextColor;
|
|
3881
3884
|
const tableThemeFace = getPresentationFonts(pres)?.minorLatin ?? null;
|
|
3882
3885
|
const out = [];
|
|
3883
3886
|
out.push(`<g${transform}>`);
|
|
@@ -4456,6 +4459,8 @@ var renderSlideSvg = (pres, slide, opts = {}) => {
|
|
|
4456
4459
|
const W = size.width;
|
|
4457
4460
|
const H = size.height;
|
|
4458
4461
|
const theme = getPresentationTheme(pres);
|
|
4462
|
+
activeColorMap = getEffectiveColorMap(slide);
|
|
4463
|
+
activeDeckTextColor = resolveDeckBodyTextColor(slide) ?? "#000000";
|
|
4459
4464
|
const ctx = {
|
|
4460
4465
|
mode: opts.textLayout ?? "foreignObject",
|
|
4461
4466
|
measure: opts.measureText ?? defaultMeasurer
|