pptx-react-viewer 4.7.0 → 4.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.
- package/CHANGELOG.md +146 -0
- package/dist/{AiChatPanel-3YILWCBX.js → AiChatPanel-WJ64Q6KO.js} +28 -28
- package/dist/AiChatPanel-WJ64Q6KO.js.br +0 -0
- package/dist/AiChatPanel-WJ64Q6KO.js.gz +0 -0
- package/dist/{AiChatPanel-X2MVL5UP.mjs → AiChatPanel-YRWC7C3B.mjs} +4 -4
- package/dist/AiChatPanel-YRWC7C3B.mjs.br +0 -0
- package/dist/AiChatPanel-YRWC7C3B.mjs.gz +0 -0
- package/dist/{Model3DScene-QFWI5CEE.mjs → Model3DScene-DS6AQWFV.mjs} +1 -1
- package/dist/Model3DScene-DS6AQWFV.mjs.br +0 -0
- package/dist/Model3DScene-DS6AQWFV.mjs.gz +0 -0
- package/dist/{Model3DScene-G7P6ZAIO.js → Model3DScene-VHDYCHO5.js} +2 -2
- package/dist/{Model3DScene-G7P6ZAIO.js.br → Model3DScene-VHDYCHO5.js.br} +0 -0
- package/dist/Model3DScene-VHDYCHO5.js.gz +0 -0
- package/dist/{chunk-FYAOOACZ.js → chunk-7NTNFOPT.js} +287 -255
- package/dist/chunk-7NTNFOPT.js.br +0 -0
- package/dist/chunk-7NTNFOPT.js.gz +0 -0
- package/dist/{chunk-WIEBQGQI.mjs → chunk-HDH4KFDK.mjs} +323 -96
- package/dist/chunk-HDH4KFDK.mjs.br +0 -0
- package/dist/chunk-HDH4KFDK.mjs.gz +0 -0
- package/dist/{chunk-UBYFLXAU.mjs → chunk-K5HZD63F.mjs} +2548 -1857
- package/dist/chunk-K5HZD63F.mjs.br +0 -0
- package/dist/chunk-K5HZD63F.mjs.gz +0 -0
- package/dist/{chunk-UIAU3NR2.js → chunk-KPKO2ELT.js} +323 -96
- package/dist/chunk-KPKO2ELT.js.br +0 -0
- package/dist/chunk-KPKO2ELT.js.gz +0 -0
- package/dist/{chunk-OECUSL2B.mjs → chunk-M6KW27TZ.mjs} +8 -7
- package/dist/chunk-M6KW27TZ.mjs.br +0 -0
- package/dist/chunk-M6KW27TZ.mjs.gz +0 -0
- package/dist/{chunk-VF4RA27Q.js → chunk-NMXIX7E4.js} +4565 -3874
- package/dist/chunk-NMXIX7E4.js.br +0 -0
- package/dist/chunk-NMXIX7E4.js.gz +0 -0
- package/dist/{chunk-QLDHUKH2.mjs → chunk-PJT2DTOS.mjs} +43189 -15692
- package/dist/chunk-PJT2DTOS.mjs.br +0 -0
- package/dist/chunk-PJT2DTOS.mjs.gz +0 -0
- package/dist/{chunk-2BM4GBFZ.js → chunk-PSJTZIIK.js} +5 -5
- package/dist/chunk-PSJTZIIK.js.br +0 -0
- package/dist/chunk-PSJTZIIK.js.gz +0 -0
- package/dist/{chunk-5J6NW3YS.mjs → chunk-Y7RTQOD6.mjs} +81 -49
- package/dist/chunk-Y7RTQOD6.mjs.br +0 -0
- package/dist/chunk-Y7RTQOD6.mjs.gz +0 -0
- package/dist/{chunk-AQIXKTAT.js → chunk-YWAFJZ23.js} +43214 -15695
- package/dist/chunk-YWAFJZ23.js.br +0 -0
- package/dist/chunk-YWAFJZ23.js.gz +0 -0
- package/dist/{chunk-SR7ETIBF.js → chunk-ZZ6IPWOP.js} +819 -818
- package/dist/chunk-ZZ6IPWOP.js.br +0 -0
- package/dist/chunk-ZZ6IPWOP.js.gz +0 -0
- package/dist/{chunk-E5OIDWHO.mjs → chunk-ZZY24BB7.mjs} +1 -1
- package/dist/chunk-ZZY24BB7.mjs.br +0 -0
- package/dist/chunk-ZZY24BB7.mjs.gz +0 -0
- package/dist/i18n/de.cjs +340 -105
- package/dist/i18n/de.cjs.br +0 -0
- package/dist/i18n/de.cjs.gz +0 -0
- package/dist/i18n/de.mjs +340 -105
- package/dist/i18n/de.mjs.br +0 -0
- package/dist/i18n/de.mjs.gz +0 -0
- package/dist/i18n/es.cjs +340 -105
- package/dist/i18n/es.cjs.br +0 -0
- package/dist/i18n/es.cjs.gz +0 -0
- package/dist/i18n/es.mjs +340 -105
- package/dist/i18n/es.mjs.br +0 -0
- package/dist/i18n/es.mjs.gz +0 -0
- package/dist/i18n/fr.cjs +340 -105
- package/dist/i18n/fr.cjs.br +0 -0
- package/dist/i18n/fr.cjs.gz +0 -0
- package/dist/i18n/fr.mjs +340 -105
- package/dist/i18n/fr.mjs.br +0 -0
- package/dist/i18n/fr.mjs.gz +0 -0
- package/dist/i18n/zh-CN.cjs +342 -107
- package/dist/i18n/zh-CN.cjs.br +0 -0
- package/dist/i18n/zh-CN.cjs.gz +0 -0
- package/dist/i18n/zh-CN.mjs +342 -107
- package/dist/i18n/zh-CN.mjs.br +0 -0
- package/dist/i18n/zh-CN.mjs.gz +0 -0
- package/dist/i18n.js +4 -4
- package/dist/i18n.js.br +0 -0
- package/dist/i18n.js.gz +0 -0
- package/dist/i18n.mjs +1 -1
- package/dist/i18n.mjs.br +0 -0
- package/dist/i18n.mjs.gz +0 -0
- package/dist/index.d.ts +762 -22
- package/dist/index.js +63 -63
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +754 -11
- package/dist/internals.js +105 -105
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +4 -4
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/pptx-viewer.css +1 -1
- package/dist/pptx-viewer.css.br +0 -0
- package/dist/pptx-viewer.css.gz +0 -0
- package/dist/viewer/index.d.ts +739 -22
- package/dist/viewer/index.js +27 -27
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +6 -6
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +3 -2
- package/dist/AiChatPanel-3YILWCBX.js.br +0 -0
- package/dist/AiChatPanel-3YILWCBX.js.gz +0 -0
- package/dist/AiChatPanel-X2MVL5UP.mjs.br +0 -0
- package/dist/AiChatPanel-X2MVL5UP.mjs.gz +0 -0
- package/dist/Model3DScene-G7P6ZAIO.js.gz +0 -0
- package/dist/Model3DScene-QFWI5CEE.mjs.br +0 -0
- package/dist/Model3DScene-QFWI5CEE.mjs.gz +0 -0
- package/dist/chunk-2BM4GBFZ.js.br +0 -0
- package/dist/chunk-2BM4GBFZ.js.gz +0 -0
- package/dist/chunk-5J6NW3YS.mjs.br +0 -0
- package/dist/chunk-5J6NW3YS.mjs.gz +0 -0
- package/dist/chunk-AQIXKTAT.js.br +0 -0
- package/dist/chunk-AQIXKTAT.js.gz +0 -0
- package/dist/chunk-E5OIDWHO.mjs.br +0 -0
- package/dist/chunk-E5OIDWHO.mjs.gz +0 -0
- package/dist/chunk-FYAOOACZ.js.br +0 -0
- package/dist/chunk-FYAOOACZ.js.gz +0 -0
- package/dist/chunk-OECUSL2B.mjs.br +0 -0
- package/dist/chunk-OECUSL2B.mjs.gz +0 -0
- package/dist/chunk-QLDHUKH2.mjs.br +0 -0
- package/dist/chunk-QLDHUKH2.mjs.gz +0 -0
- package/dist/chunk-SR7ETIBF.js.br +0 -0
- package/dist/chunk-SR7ETIBF.js.gz +0 -0
- package/dist/chunk-UBYFLXAU.mjs.br +0 -0
- package/dist/chunk-UBYFLXAU.mjs.gz +0 -0
- package/dist/chunk-UIAU3NR2.js.br +0 -0
- package/dist/chunk-UIAU3NR2.js.gz +0 -0
- package/dist/chunk-VF4RA27Q.js.br +0 -0
- package/dist/chunk-VF4RA27Q.js.gz +0 -0
- package/dist/chunk-WIEBQGQI.mjs.br +0 -0
- package/dist/chunk-WIEBQGQI.mjs.gz +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkYWAFJZ23_js = require('./chunk-YWAFJZ23.js');
|
|
4
4
|
var chunk4VNS5WPM_js = require('./chunk-4VNS5WPM.js');
|
|
5
5
|
var mcp = require('pptx-viewer-mcp');
|
|
6
6
|
var mcpSchemas = require('pptx-viewer-mcp/schemas');
|
|
@@ -19079,7 +19079,7 @@ async function buildSlideMarkdown(slides, slideIndex2, meta3, options = {}) {
|
|
|
19079
19079
|
};
|
|
19080
19080
|
let markdown;
|
|
19081
19081
|
try {
|
|
19082
|
-
const converter = new
|
|
19082
|
+
const converter = new chunkYWAFJZ23_js.PptxMarkdownConverter(
|
|
19083
19083
|
"",
|
|
19084
19084
|
{
|
|
19085
19085
|
sourceName: meta3.title ?? "deck.pptx",
|
|
@@ -19671,7 +19671,7 @@ var getTheme = (ctx) => {
|
|
|
19671
19671
|
name: theme?.name,
|
|
19672
19672
|
colorScheme: theme?.colorScheme,
|
|
19673
19673
|
fontScheme: theme?.fontScheme,
|
|
19674
|
-
availablePresets: Object.keys(
|
|
19674
|
+
availablePresets: Object.keys(chunkYWAFJZ23_js.ThemePresets)
|
|
19675
19675
|
};
|
|
19676
19676
|
};
|
|
19677
19677
|
var readExecutors = {
|
|
@@ -20801,7 +20801,7 @@ function applyElementUpdate(el, u) {
|
|
|
20801
20801
|
applyShapeStyleUpdate(el, u);
|
|
20802
20802
|
}
|
|
20803
20803
|
function applyTextUpdate(el, u) {
|
|
20804
|
-
if (!
|
|
20804
|
+
if (!chunkYWAFJZ23_js.hasTextProperties(el)) {
|
|
20805
20805
|
return;
|
|
20806
20806
|
}
|
|
20807
20807
|
const textEl = el;
|
|
@@ -20847,7 +20847,7 @@ function applyShapeStyleUpdate(el, u) {
|
|
|
20847
20847
|
if (u.fillColor === void 0 && u.strokeColor === void 0 && u.strokeWidth === void 0) {
|
|
20848
20848
|
return;
|
|
20849
20849
|
}
|
|
20850
|
-
if (!
|
|
20850
|
+
if (!chunkYWAFJZ23_js.hasShapeProperties(el)) {
|
|
20851
20851
|
return;
|
|
20852
20852
|
}
|
|
20853
20853
|
const holder = el;
|
|
Binary file
|
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SHAPE_PRESET_DEFS, VIEWER_SHORTCUT_REFERENCE, STROKE_DASH_OPTIONS, getAnimationInitialStyle, cloneHistorySnapshot, hasShapeProperties, getImageFitStyle, getImageFillCounterTransform, getComputedFillStyle, isImageLikeElement, getCropShapeClipPath, getImageTilingStyle, mediaPlaybackAttributes, getOnlineVideoEmbed, ONLINE_VIDEO_IFRAME_SANDBOX, ONLINE_VIDEO_IFRAME_ALLOW, buildTextBlockStyle, hasTextProperties, toCssWritingMode, toCssTextOrientation, toCssVerticalDirection, buildTextBodyLayoutStyle, buildTextBody3DSceneStyle, buildParagraphs, colorWithOpacity, normalizeHexColor, hexToRgbUnit, build3DExtrusionData, getComputedEffectStyle, getComputedStrokeStyle, getAnimationColorBaseStyle, isStrokeOnlyPresetElement, resolveShapeGeometry, getConnectorPathGeometry, normalizeStrokeDashType, getSvgStrokeDasharray, buildSvgGradientDef, buildStrokeOutline, getPresetShapeVectorGeometry, isWedgeCalloutPresetShape, svgGradientFillRef, isCalloutShape, getCalloutLeaderLineGeometry, buildCalloutLeaderLineSvgPath, getCalloutViewBoxBounds, svgLineCap, getCompoundLineOffsets, getCompoundLineWidths, canDrillDown, computeSelectionRect, DEFAULT_FONT_FAMILY, cellStyleToCss, rectToCells, isCellInRect, tableContainerCss, buildChartViewModel, resolveChartKind, chartPreserveAspectRatio, buildNotesPdfBytes, buildTiledSlidesPdfBytes, buildPreviewAnimation, buildMotionPathPreview, mediaFallbackVisual, scheduleMediaTrimAndFade, registerCrossSlideAudio, shouldShowMediaFullscreenStopButton, withInlineListDecorationDefaults, segmentStyleToCss, resolveAutoFitFontScale, applyUnderlineVariant, nestedTextDecorationStyle, scaleFontSizeForAutoFit, resolveFontKerning, getSubstituteFontFamily, parsePanoseString, resolveScriptFontSet, hasDistinctScriptFonts, pieceLetterSpacing, resolveMetricTrackingPx, hollowTextFillStyle, splitsUnderlineIntoWords, stripUnderlineDecoration, buildTabContext, TEXT_BUILD_ID_SEP, buildTextBuildSpec, textBuildSpanStyle, apply3dEffects, customGeometryPathsToSvgSubpaths, buildSubpathPaints, computeColumnBoundaries, getTableCellBandStyle, parseDrawingColor, parseDrawingColorOpacity, getCellDiagonalBorders, xmlText, cellRunStyle, getChartStylePalette, computeChartLegendLayout, mediaFallbackIcon, mediaFallbackLabelKey, MEDIA_CHROME_ATTRIBUTE, convertOmmlToMathMl, sanitizeMathMl, tableCellCss, computeResizedColumnWidths, computeResizedRowHeight, DEFAULT_ROW_HEIGHT, ooxmlGradientAngleToCssDegrees, buildRectPathGradient, buildRunTabLines, chartPartToAttrs, splitWordsForUnderline, splitRunForMetrics, splitRunByScriptFont } from './chunk-
|
|
2
|
-
import { translationsEn } from './chunk-
|
|
1
|
+
import { SHAPE_PRESET_DEFS, VIEWER_SHORTCUT_REFERENCE, STROKE_DASH_OPTIONS, getAnimationInitialStyle, cloneHistorySnapshot, hasShapeProperties, getImageFitStyle, getImageFillCounterTransform, getComputedFillStyle, isImageLikeElement, getCropShapeClipPath, getImageTilingStyle, mediaPlaybackAttributes, getOnlineVideoEmbed, ONLINE_VIDEO_IFRAME_SANDBOX, ONLINE_VIDEO_IFRAME_ALLOW, buildTextBlockStyle, hasTextProperties, toCssWritingMode, toCssTextOrientation, toCssVerticalDirection, buildTextBodyLayoutStyle, buildTextBody3DSceneStyle, buildParagraphs, followingText, colorWithOpacity, normalizeHexColor, hexToRgbUnit, build3DExtrusionData, getComputedEffectStyle, getComputedStrokeStyle, getAnimationColorBaseStyle, isStrokeOnlyPresetElement, resolveShapeGeometry, getConnectorPathGeometry, normalizeStrokeDashType, getSvgStrokeDasharray, buildSvgGradientDef, buildStrokeOutline, getPresetShapeVectorGeometry, isWedgeCalloutPresetShape, svgGradientFillRef, isCalloutShape, getCalloutLeaderLineGeometry, buildCalloutLeaderLineSvgPath, getCalloutViewBoxBounds, svgLineCap, getCompoundLineOffsets, getCompoundLineWidths, canDrillDown, computeSelectionRect, DEFAULT_FONT_FAMILY, cellStyleToCss, rectToCells, isCellInRect, tableContainerCss, buildChartViewModel, resolveChartKind, chartPreserveAspectRatio, buildNotesPdfBytes, buildTiledSlidesPdfBytes, buildPreviewAnimation, measurePreviewGeometry, buildMotionPathPreview, mediaFallbackVisual, scheduleMediaTrimAndFade, registerCrossSlideAudio, shouldShowMediaFullscreenStopButton, withInlineListDecorationDefaults, segmentStyleToCss, resolveAutoFitFontScale, applyUnderlineVariant, nestedTextDecorationStyle, scaleFontSizeForAutoFit, resolveFontKerning, getSubstituteFontFamily, parsePanoseString, resolveScriptFontSet, hasDistinctScriptFonts, authoredLetterSpacingPx, pieceLetterSpacing, resolveMetricTrackingPx, hollowTextFillStyle, splitsUnderlineIntoWords, stripUnderlineDecoration, buildTabContext, TEXT_BUILD_ID_SEP, buildTextBuildSpec, textBuildSpanStyle, apply3dEffects, customGeometryPathsToSvgSubpaths, buildSubpathPaints, computeColumnBoundaries, getTableCellBandStyle, parseDrawingColor, parseDrawingColorOpacity, getCellDiagonalBorders, xmlText, cellRunStyle, getChartStylePalette, computeChartLegendLayout, mediaFallbackIcon, mediaFallbackLabelKey, MEDIA_CHROME_ATTRIBUTE, convertOmmlToMathMl, sanitizeMathMl, tableCellCss, computeResizedColumnWidths, computeResizedRowHeight, DEFAULT_ROW_HEIGHT, ooxmlGradientAngleToCssDegrees, buildRectPathGradient, buildRunTabLines, chartPartToAttrs, splitWordsForUnderline, splitRunForMetrics, splitEastAsianBreaks, splitRunByScriptFont } from './chunk-PJT2DTOS.mjs';
|
|
2
|
+
import { translationsEn } from './chunk-HDH4KFDK.mjs';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
import
|
|
5
|
+
import React8, { useRef, useState, useEffect, useCallback, useMemo, useLayoutEffect } from 'react';
|
|
6
6
|
import { LuTriangle, LuPlus, LuMoveRight, LuMinus, LuDiamond, LuDatabase, LuCircle, LuSquare } from 'react-icons/lu';
|
|
7
7
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
@@ -88,7 +88,7 @@ var SHAPE_PRESETS = SHAPE_PRESET_DEFS.map(
|
|
|
88
88
|
type: def.type,
|
|
89
89
|
label: def.label,
|
|
90
90
|
i18nKey: def.i18nKey,
|
|
91
|
-
icon:
|
|
91
|
+
icon: React8.createElement(GLYPH_COMPONENTS[def.glyph], {
|
|
92
92
|
className: def.glyphClass ? `w-3.5 h-3.5 ${def.glyphClass}` : "w-3.5 h-3.5"
|
|
93
93
|
})
|
|
94
94
|
})
|
|
@@ -1045,7 +1045,7 @@ function wrapWithTextBuildAnimation(elementId, paraIndex, renderedSegments, para
|
|
|
1045
1045
|
return spec.spans.map((span, index) => {
|
|
1046
1046
|
const content = span.style && renderPiece ? renderPiece(span.style, span.text, String(index)) : span.text;
|
|
1047
1047
|
if (!span.animId) {
|
|
1048
|
-
return /* @__PURE__ */ jsx(
|
|
1048
|
+
return /* @__PURE__ */ jsx(React8.Fragment, { children: content }, `ws-${index}`);
|
|
1049
1049
|
}
|
|
1050
1050
|
return /* @__PURE__ */ jsx(
|
|
1051
1051
|
"span",
|
|
@@ -1072,18 +1072,19 @@ function renderUnderlineWords(text, isUnderlineWords, wordDecoration, metric, ke
|
|
|
1072
1072
|
} : void 0;
|
|
1073
1073
|
return pieces.map((piece, i) => {
|
|
1074
1074
|
const key = `${keyPrefix}-u${i}`;
|
|
1075
|
+
const following = followingText(pieces, i, metric?.following);
|
|
1075
1076
|
if (!piece.underline) {
|
|
1076
|
-
return /* @__PURE__ */ jsx(
|
|
1077
|
+
return /* @__PURE__ */ jsx(React8.Fragment, { children: inner(piece.text, key, gapMetric && { ...gapMetric, following }) }, key);
|
|
1077
1078
|
}
|
|
1078
|
-
return /* @__PURE__ */ jsx("span", { style: wordDecoration, children: inner(piece.text, key, metric) }, key);
|
|
1079
|
+
return /* @__PURE__ */ jsx("span", { style: wordDecoration, children: inner(piece.text, key, metric && { ...metric, following }) }, key);
|
|
1079
1080
|
});
|
|
1080
1081
|
}
|
|
1081
1082
|
function makeSegmentPieceRenderer(needsScriptFonts, scriptFonts, baseFontFamily, isUnderlineWords, wordDecoration, metric) {
|
|
1082
|
-
return (text, key) => renderUnderlineWords(
|
|
1083
|
+
return (text, key, following) => renderUnderlineWords(
|
|
1083
1084
|
text,
|
|
1084
1085
|
isUnderlineWords,
|
|
1085
1086
|
wordDecoration,
|
|
1086
|
-
metric,
|
|
1087
|
+
metric && { ...metric, following },
|
|
1087
1088
|
key,
|
|
1088
1089
|
(subText, subKey, subMetric) => renderMetricPieces(
|
|
1089
1090
|
subText,
|
|
@@ -1110,12 +1111,46 @@ function renderTabbedLine(line, ctx, keyPrefix, renderPiece, nestedStyle, underl
|
|
|
1110
1111
|
);
|
|
1111
1112
|
return /* @__PURE__ */ jsx("span", { style: { display: "inline-block", whiteSpace: "nowrap" }, children: lineLayout.pieces.map((piece, i) => {
|
|
1112
1113
|
const key = `${keyPrefix}-tab-${i}`;
|
|
1113
|
-
return /* @__PURE__ */ jsxs(
|
|
1114
|
+
return /* @__PURE__ */ jsxs(React8.Fragment, { children: [
|
|
1114
1115
|
piece.leaderStyle ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: piece.leaderStyle, children: piece.leaderText }) : null,
|
|
1115
1116
|
piece.words ? piece.words.map((word, w) => /* @__PURE__ */ jsx("span", { style: word.style, children: renderPiece(word.text, `${key}-w${w}`) }, `${key}-w${w}`)) : /* @__PURE__ */ jsx("span", { style: piece.style, children: renderPiece(piece.text, key) })
|
|
1116
1117
|
] }, key);
|
|
1117
1118
|
}) });
|
|
1118
1119
|
}
|
|
1120
|
+
function renderEastAsianPieces(text, metric, keyPrefix, inner, baseStyle, following) {
|
|
1121
|
+
const parts = splitEastAsianBreaks(text, metric.eastAsian, metric.font, following);
|
|
1122
|
+
if (parts.length === 1 && !parts[0].style) {
|
|
1123
|
+
return inner(parts[0].text, keyPrefix);
|
|
1124
|
+
}
|
|
1125
|
+
return parts.map((part, i) => {
|
|
1126
|
+
const key = `${keyPrefix}-e${i}`;
|
|
1127
|
+
return part.style ? /* @__PURE__ */ jsx("span", { style: { ...baseStyle ?? metric.nestedStyle, ...part.style }, children: inner(part.text, key) }, key) : /* @__PURE__ */ jsx(React8.Fragment, { children: inner(part.text, key) }, key);
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
function renderMetricPieces(text, metric, keyPrefix, inner) {
|
|
1131
|
+
if (!metric || !text) {
|
|
1132
|
+
return inner(text, keyPrefix);
|
|
1133
|
+
}
|
|
1134
|
+
const pieces = splitRunForMetrics(text, metric.font);
|
|
1135
|
+
if (pieces.length <= 1) {
|
|
1136
|
+
return renderEastAsianPieces(text, metric, keyPrefix, inner, void 0, metric.following);
|
|
1137
|
+
}
|
|
1138
|
+
return pieces.map((piece, i) => {
|
|
1139
|
+
const key = `${keyPrefix}-w${i}`;
|
|
1140
|
+
const style = {
|
|
1141
|
+
...metric.nestedStyle,
|
|
1142
|
+
letterSpacing: pieceLetterSpacing(metric.authoredPx, piece.tracking)
|
|
1143
|
+
};
|
|
1144
|
+
return /* @__PURE__ */ jsx("span", { style, children: renderEastAsianPieces(
|
|
1145
|
+
piece.text,
|
|
1146
|
+
metric,
|
|
1147
|
+
key,
|
|
1148
|
+
inner,
|
|
1149
|
+
style,
|
|
1150
|
+
followingText(pieces, i, metric.following)
|
|
1151
|
+
) }, key);
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1119
1154
|
function renderScriptAwareText(text, needsScriptFonts, scriptFonts, baseFontFamily, keyPrefix, nestedStyle) {
|
|
1120
1155
|
if (!needsScriptFonts || !text) {
|
|
1121
1156
|
return text;
|
|
@@ -1130,29 +1165,9 @@ function renderScriptAwareText(text, needsScriptFonts, scriptFonts, baseFontFami
|
|
|
1130
1165
|
return text;
|
|
1131
1166
|
}
|
|
1132
1167
|
return pieces.map(
|
|
1133
|
-
(piece, i) => piece.style ? /* @__PURE__ */ jsx("span", { style: piece.style, children: piece.text }, `${keyPrefix}-r${i}`) : /* @__PURE__ */ jsx(
|
|
1168
|
+
(piece, i) => piece.style ? /* @__PURE__ */ jsx("span", { style: piece.style, children: piece.text }, `${keyPrefix}-r${i}`) : /* @__PURE__ */ jsx(React8.Fragment, { children: piece.text }, `${keyPrefix}-r${i}`)
|
|
1134
1169
|
);
|
|
1135
1170
|
}
|
|
1136
|
-
function renderMetricPieces(text, metric, keyPrefix, inner) {
|
|
1137
|
-
if (!metric || !text) {
|
|
1138
|
-
return inner(text, keyPrefix);
|
|
1139
|
-
}
|
|
1140
|
-
const pieces = splitRunForMetrics(text, metric.font);
|
|
1141
|
-
if (pieces.length <= 1) {
|
|
1142
|
-
return inner(text, keyPrefix);
|
|
1143
|
-
}
|
|
1144
|
-
return pieces.map((piece, i) => /* @__PURE__ */ jsx(
|
|
1145
|
-
"span",
|
|
1146
|
-
{
|
|
1147
|
-
style: {
|
|
1148
|
-
...metric.nestedStyle,
|
|
1149
|
-
letterSpacing: pieceLetterSpacing(metric.authoredPx, piece.tracking)
|
|
1150
|
-
},
|
|
1151
|
-
children: inner(piece.text, `${keyPrefix}-w${i}`)
|
|
1152
|
-
},
|
|
1153
|
-
`${keyPrefix}-w${i}`
|
|
1154
|
-
));
|
|
1155
|
-
}
|
|
1156
1171
|
function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsScriptFonts, scriptFonts, baseFontFamily, findHighlights, tabContext, metric, isUnderlineWords = false, wordDecoration) {
|
|
1157
1172
|
const segHl = findHighlights?.get(segmentIndex);
|
|
1158
1173
|
const renderLeaf = makeSegmentPieceRenderer(
|
|
@@ -1166,7 +1181,7 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
1166
1181
|
if (!segHl || segHl.length === 0) {
|
|
1167
1182
|
return lines.map((line, lineIndex) => {
|
|
1168
1183
|
const lineKey = `${elementId}-seg-${segmentIndex}-line-${lineIndex}`;
|
|
1169
|
-
return /* @__PURE__ */ jsxs(
|
|
1184
|
+
return /* @__PURE__ */ jsxs(React8.Fragment, { children: [
|
|
1170
1185
|
tabContext && line.includes(" ") ? renderTabbedLine(
|
|
1171
1186
|
line,
|
|
1172
1187
|
tabContext,
|
|
@@ -1174,7 +1189,7 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
1174
1189
|
renderLeaf,
|
|
1175
1190
|
metric?.nestedStyle,
|
|
1176
1191
|
isUnderlineWords
|
|
1177
|
-
) : renderLeaf(line, lineKey),
|
|
1192
|
+
) : renderLeaf(line, lineKey, lineIndex < lines.length - 1 ? "\n" : metric?.following),
|
|
1178
1193
|
lineIndex < lines.length - 1 ? /* @__PURE__ */ jsx("br", {}) : null
|
|
1179
1194
|
] }, lineKey);
|
|
1180
1195
|
});
|
|
@@ -1215,10 +1230,10 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
1215
1230
|
color: "inherit",
|
|
1216
1231
|
borderRadius: 2
|
|
1217
1232
|
},
|
|
1218
|
-
children: renderLeaf(chunk.text, chunkKey)
|
|
1233
|
+
children: renderLeaf(chunk.text, chunkKey, followingText(chunks, ci, metric?.following))
|
|
1219
1234
|
},
|
|
1220
1235
|
chunkKey
|
|
1221
|
-
) : /* @__PURE__ */ jsx(
|
|
1236
|
+
) : /* @__PURE__ */ jsx(React8.Fragment, { children: renderLeaf(chunk.text, chunkKey, followingText(chunks, ci, metric?.following)) }, chunkKey);
|
|
1222
1237
|
});
|
|
1223
1238
|
}
|
|
1224
1239
|
function renderEquationSegment(elementId, segmentIndex, equationXml, equationNumber, fontSize) {
|
|
@@ -1387,7 +1402,7 @@ function renderParagraphRun(run, segment, ctx, keySuffix = "") {
|
|
|
1387
1402
|
) : DEFAULT_FONT_FAMILY2;
|
|
1388
1403
|
const scriptFonts = resolveScriptFontSet(segmentStyle, element.textStyle, baseFontFamily);
|
|
1389
1404
|
const needsScriptFonts = hasDistinctScriptFonts(scriptFonts);
|
|
1390
|
-
const authoredLetterSpacing =
|
|
1405
|
+
const authoredLetterSpacing = authoredLetterSpacingPx(segmentStyle);
|
|
1391
1406
|
const metricFont = {
|
|
1392
1407
|
fontFamily: baseFontFamily,
|
|
1393
1408
|
fontSizePx: baseFontSize * baselineFontScale,
|
|
@@ -1395,7 +1410,13 @@ function renderParagraphRun(run, segment, ctx, keySuffix = "") {
|
|
|
1395
1410
|
italic: Boolean(segmentStyle.italic)
|
|
1396
1411
|
};
|
|
1397
1412
|
const nestedStyle = nestedTextDecorationStyle(run.style);
|
|
1398
|
-
const metricContext = {
|
|
1413
|
+
const metricContext = {
|
|
1414
|
+
font: metricFont,
|
|
1415
|
+
authoredPx: authoredLetterSpacing,
|
|
1416
|
+
nestedStyle,
|
|
1417
|
+
eastAsian: ctx.eastAsianBreaks,
|
|
1418
|
+
following: ctx.eastAsianFollowing
|
|
1419
|
+
};
|
|
1399
1420
|
const spanStyle = { ...run.style };
|
|
1400
1421
|
spanStyle.color = resolvedSegmentColor;
|
|
1401
1422
|
spanStyle.fontSize = baseFontSize * baselineFontScale;
|
|
@@ -1483,10 +1504,10 @@ function renderSeededListRun(seed, runs, segments, context) {
|
|
|
1483
1504
|
segmentIndex: seed.segmentIndex
|
|
1484
1505
|
};
|
|
1485
1506
|
const rendered = renderParagraphRun(run, resolvedSegment, context);
|
|
1486
|
-
if (!
|
|
1507
|
+
if (!React8.isValidElement(rendered)) {
|
|
1487
1508
|
return rendered;
|
|
1488
1509
|
}
|
|
1489
|
-
return
|
|
1510
|
+
return React8.cloneElement(rendered, {
|
|
1490
1511
|
"data-pptx-list-run": seed.token,
|
|
1491
1512
|
...seed.text === "" ? { children: /* @__PURE__ */ jsx("br", {}) } : {}
|
|
1492
1513
|
});
|
|
@@ -1502,12 +1523,10 @@ function renderTextSegments(element, fallbackColor, emptyFallback, findHighlight
|
|
|
1502
1523
|
}
|
|
1503
1524
|
return element.text || emptyFallback || "";
|
|
1504
1525
|
}
|
|
1505
|
-
const paragraphs = buildParagraphs(
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
inlineListSeed ? { preserveTrailingEmpty: true } : void 0
|
|
1510
|
-
);
|
|
1526
|
+
const paragraphs = buildParagraphs(element, fieldContext, segmentOverrides, {
|
|
1527
|
+
preserveTrailingEmpty: inlineListSeed ? true : void 0,
|
|
1528
|
+
eastAsianRunPieces: false
|
|
1529
|
+
});
|
|
1511
1530
|
const ctx = {
|
|
1512
1531
|
element,
|
|
1513
1532
|
fallbackColor,
|
|
@@ -1541,10 +1560,19 @@ function joinRunsBySegment(runs) {
|
|
|
1541
1560
|
}
|
|
1542
1561
|
function renderParagraph(para, paraIndex, paraCount, segments, ctx, subElementAnimStates, inlineListSeed) {
|
|
1543
1562
|
const element = ctx.element;
|
|
1544
|
-
const runCtx = {
|
|
1563
|
+
const runCtx = {
|
|
1564
|
+
...ctx,
|
|
1565
|
+
paragraphRtl: para.rtl,
|
|
1566
|
+
eastAsianBreaks: para.eastAsianBreaks
|
|
1567
|
+
};
|
|
1545
1568
|
const runs = joinRunsBySegment(para.runs);
|
|
1546
1569
|
const listParagraph = inlineListSeed?.paragraphs[paraIndex];
|
|
1547
|
-
const renderedRuns = listParagraph ? listParagraph.runs.map((run) => renderSeededListRun(run, runs, segments, runCtx)) : runs.map(
|
|
1570
|
+
const renderedRuns = listParagraph ? listParagraph.runs.map((run) => renderSeededListRun(run, runs, segments, runCtx)) : runs.map(
|
|
1571
|
+
(run, i) => renderParagraphRun(run, segments[run.segmentIndex ?? -1], {
|
|
1572
|
+
...runCtx,
|
|
1573
|
+
eastAsianFollowing: para.eastAsianBreaks ? followingText(runs, i) : void 0
|
|
1574
|
+
})
|
|
1575
|
+
);
|
|
1548
1576
|
const paraStyle = {
|
|
1549
1577
|
// `text-align`, BiDi `direction` / `unicode-bidi` and the kinsoku
|
|
1550
1578
|
// line-break rules, resolved by shared from this paragraph's own `a:pPr`.
|
|
@@ -1591,7 +1619,7 @@ function renderParagraph(para, paraIndex, paraCount, segments, ctx, subElementAn
|
|
|
1591
1619
|
);
|
|
1592
1620
|
const needsWrapper = Boolean(listParagraph) || Object.keys(paraStyle).length > 0 || marker !== null;
|
|
1593
1621
|
if (!needsWrapper) {
|
|
1594
|
-
return /* @__PURE__ */ jsxs(
|
|
1622
|
+
return /* @__PURE__ */ jsxs(React8.Fragment, { children: [
|
|
1595
1623
|
wrappedContent,
|
|
1596
1624
|
paraIndex < paraCount - 1 ? /* @__PURE__ */ jsx("br", {}) : null
|
|
1597
1625
|
] }, `${element.id}-para-${paraIndex}`);
|
|
@@ -3804,7 +3832,11 @@ function buildPdfFromTiledImageData(pages) {
|
|
|
3804
3832
|
var activePreview = null;
|
|
3805
3833
|
function startPreviewAnimation(elementId, preset, options) {
|
|
3806
3834
|
stopPreviewAnimation();
|
|
3807
|
-
const
|
|
3835
|
+
const domEl = document.querySelector(`[data-element-id="${elementId}"]`);
|
|
3836
|
+
const descriptor = buildPreviewAnimation(preset, {
|
|
3837
|
+
...options,
|
|
3838
|
+
geometry: domEl ? measurePreviewGeometry(domEl) : void 0
|
|
3839
|
+
});
|
|
3808
3840
|
if (!descriptor) {
|
|
3809
3841
|
return;
|
|
3810
3842
|
}
|
|
Binary file
|
|
Binary file
|