pptx-react-viewer 3.5.3 → 3.6.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 +12 -0
- package/dist/{AiChatPanel-ZEM3ZVA6.js → AiChatPanel-LEOEDIW2.js} +25 -25
- package/dist/AiChatPanel-LEOEDIW2.js.br +0 -0
- package/dist/AiChatPanel-LEOEDIW2.js.gz +0 -0
- package/dist/{AiChatPanel-L2HGGEND.mjs → AiChatPanel-WRQGJJVD.mjs} +4 -4
- package/dist/AiChatPanel-WRQGJJVD.mjs.br +0 -0
- package/dist/AiChatPanel-WRQGJJVD.mjs.gz +0 -0
- package/dist/{Area3DChartScene-I7LMTNK5.js → Area3DChartScene-3TJ2GTGI.js} +2 -2
- package/dist/Area3DChartScene-3TJ2GTGI.js.br +0 -0
- package/dist/Area3DChartScene-3TJ2GTGI.js.gz +0 -0
- package/dist/{Area3DChartScene-EYNCHRB3.mjs → Area3DChartScene-SJC2ZB6R.mjs} +1 -1
- package/dist/{Line3DChartScene-QYBKXNOD.mjs.br → Area3DChartScene-SJC2ZB6R.mjs.br} +1 -1
- package/dist/Area3DChartScene-SJC2ZB6R.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-VPKQDPIO.js → Bar3DChartScene-2ZGOMOZO.js} +2 -2
- package/dist/Bar3DChartScene-2ZGOMOZO.js.br +0 -0
- package/dist/Bar3DChartScene-2ZGOMOZO.js.gz +0 -0
- package/dist/{Bar3DChartScene-6HQ6QWNB.mjs → Bar3DChartScene-SPER4LQA.mjs} +1 -1
- package/dist/{Bar3DChartScene-6HQ6QWNB.mjs.br → Bar3DChartScene-SPER4LQA.mjs.br} +0 -0
- package/dist/Bar3DChartScene-SPER4LQA.mjs.gz +0 -0
- package/dist/{Line3DChartScene-VV362RMX.js → Line3DChartScene-42FYFGLU.js} +2 -2
- package/dist/Line3DChartScene-42FYFGLU.js.br +0 -0
- package/dist/Line3DChartScene-42FYFGLU.js.gz +0 -0
- package/dist/{Line3DChartScene-QYBKXNOD.mjs → Line3DChartScene-FH3YHPXE.mjs} +1 -1
- package/dist/{Area3DChartScene-EYNCHRB3.mjs.br → Line3DChartScene-FH3YHPXE.mjs.br} +1 -1
- package/dist/Line3DChartScene-FH3YHPXE.mjs.gz +0 -0
- package/dist/{Model3DScene-YTLWTG52.mjs → Model3DScene-2BCR2YYD.mjs} +1 -1
- package/dist/{Model3DScene-YTLWTG52.mjs.br → Model3DScene-2BCR2YYD.mjs.br} +0 -0
- package/dist/Model3DScene-2BCR2YYD.mjs.gz +0 -0
- package/dist/{Model3DScene-XA57KXA5.js → Model3DScene-EIU2GVUZ.js} +2 -2
- package/dist/Model3DScene-EIU2GVUZ.js.br +0 -0
- package/dist/Model3DScene-EIU2GVUZ.js.gz +0 -0
- package/dist/{PieChart3DScene-INBL4F5Z.mjs → PieChart3DScene-QFQUJFDP.mjs} +1 -1
- package/dist/{PieChart3DScene-INBL4F5Z.mjs.br → PieChart3DScene-QFQUJFDP.mjs.br} +0 -0
- package/dist/PieChart3DScene-QFQUJFDP.mjs.gz +0 -0
- package/dist/{PieChart3DScene-IFZMTN5H.js → PieChart3DScene-VQOHZPHI.js} +2 -2
- package/dist/PieChart3DScene-VQOHZPHI.js.br +0 -0
- package/dist/PieChart3DScene-VQOHZPHI.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-EV6DBPJS.mjs → SurfaceChart3DScene-CGXMRBCL.mjs} +1 -1
- package/dist/{SurfaceChart3DScene-EV6DBPJS.mjs.br → SurfaceChart3DScene-CGXMRBCL.mjs.br} +0 -0
- package/dist/SurfaceChart3DScene-CGXMRBCL.mjs.gz +0 -0
- package/dist/{SurfaceChart3DScene-FRSZVIVB.js → SurfaceChart3DScene-FTVXZN6O.js} +2 -2
- package/dist/SurfaceChart3DScene-FTVXZN6O.js.br +0 -0
- package/dist/SurfaceChart3DScene-FTVXZN6O.js.gz +0 -0
- package/dist/{chunk-QA573RUB.js → chunk-7VPDHSWF.js} +330 -349
- package/dist/chunk-7VPDHSWF.js.br +0 -0
- package/dist/chunk-7VPDHSWF.js.gz +0 -0
- package/dist/{chunk-HHDPQJF3.js → chunk-AL2KLPOJ.js} +32437 -22179
- package/dist/chunk-AL2KLPOJ.js.br +0 -0
- package/dist/chunk-AL2KLPOJ.js.gz +0 -0
- package/dist/{chunk-7AL6KAFX.mjs → chunk-FG5VQFWP.mjs} +193 -71
- package/dist/chunk-FG5VQFWP.mjs.br +0 -0
- package/dist/chunk-FG5VQFWP.mjs.gz +0 -0
- package/dist/{chunk-UTIMT5CZ.js → chunk-MZI4DG3S.js} +12 -0
- package/dist/chunk-MZI4DG3S.js.br +0 -0
- package/dist/{chunk-UTIMT5CZ.js.gz → chunk-MZI4DG3S.js.gz} +0 -0
- package/dist/{chunk-PPL3WBC7.js → chunk-NFOOONND.js} +1359 -1237
- package/dist/chunk-NFOOONND.js.br +0 -0
- package/dist/chunk-NFOOONND.js.gz +0 -0
- package/dist/{chunk-MSRRBA7G.mjs → chunk-T3V5FBXJ.mjs} +29 -1
- package/dist/chunk-T3V5FBXJ.mjs.br +0 -0
- package/dist/chunk-T3V5FBXJ.mjs.gz +0 -0
- package/dist/{chunk-JCJ3EPG6.mjs → chunk-TGCSZXOG.mjs} +12 -0
- package/dist/chunk-TGCSZXOG.mjs.br +0 -0
- package/dist/{chunk-JCJ3EPG6.mjs.gz → chunk-TGCSZXOG.mjs.gz} +0 -0
- package/dist/{chunk-3WM5TUY7.mjs → chunk-VYNICQ4O.mjs} +58 -37
- package/dist/chunk-VYNICQ4O.mjs.br +0 -0
- package/dist/chunk-VYNICQ4O.mjs.gz +0 -0
- package/dist/{chunk-KOLCCOTS.mjs → chunk-WX7AFFBZ.mjs} +142 -161
- package/dist/chunk-WX7AFFBZ.mjs.br +0 -0
- package/dist/chunk-WX7AFFBZ.mjs.gz +0 -0
- package/dist/{chunk-SIM2LXO2.js → chunk-ZHSBMG37.js} +490 -469
- package/dist/chunk-ZHSBMG37.js.br +0 -0
- package/dist/chunk-ZHSBMG37.js.gz +0 -0
- package/dist/{chunk-QPHGHUUJ.mjs → chunk-ZUSYUWOV.mjs} +32414 -22179
- package/dist/chunk-ZUSYUWOV.mjs.br +0 -0
- package/dist/chunk-ZUSYUWOV.mjs.gz +0 -0
- package/dist/{chunk-BBSFZLYI.js → chunk-ZWPHUPL4.js} +33 -5
- package/dist/chunk-ZWPHUPL4.js.br +0 -0
- package/dist/chunk-ZWPHUPL4.js.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 +599 -33
- package/dist/index.js +47 -47
- 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 +610 -33
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +79 -79
- 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/{useViewerBuildingBlocks-f6oNGKMX.d.ts → useViewerBuildingBlocks-C8F_4Pzb.d.ts} +3 -1
- package/dist/useViewerBuildingBlocks-C8F_4Pzb.d.ts.map +1 -0
- package/dist/viewer/index.d.ts +552 -33
- 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 +1 -1
- package/dist/AiChatPanel-L2HGGEND.mjs.br +0 -0
- package/dist/AiChatPanel-L2HGGEND.mjs.gz +0 -0
- package/dist/AiChatPanel-ZEM3ZVA6.js.br +0 -0
- package/dist/AiChatPanel-ZEM3ZVA6.js.gz +0 -0
- package/dist/Area3DChartScene-EYNCHRB3.mjs.gz +0 -0
- package/dist/Area3DChartScene-I7LMTNK5.js.br +0 -0
- package/dist/Area3DChartScene-I7LMTNK5.js.gz +0 -0
- package/dist/Bar3DChartScene-6HQ6QWNB.mjs.gz +0 -0
- package/dist/Bar3DChartScene-VPKQDPIO.js.br +0 -0
- package/dist/Bar3DChartScene-VPKQDPIO.js.gz +0 -0
- package/dist/Line3DChartScene-QYBKXNOD.mjs.gz +0 -0
- package/dist/Line3DChartScene-VV362RMX.js.br +0 -0
- package/dist/Line3DChartScene-VV362RMX.js.gz +0 -0
- package/dist/Model3DScene-XA57KXA5.js.br +0 -0
- package/dist/Model3DScene-XA57KXA5.js.gz +0 -0
- package/dist/Model3DScene-YTLWTG52.mjs.gz +0 -0
- package/dist/PieChart3DScene-IFZMTN5H.js.br +0 -0
- package/dist/PieChart3DScene-IFZMTN5H.js.gz +0 -0
- package/dist/PieChart3DScene-INBL4F5Z.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-EV6DBPJS.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-FRSZVIVB.js.br +0 -0
- package/dist/SurfaceChart3DScene-FRSZVIVB.js.gz +0 -0
- package/dist/chunk-3WM5TUY7.mjs.br +0 -0
- package/dist/chunk-3WM5TUY7.mjs.gz +0 -0
- package/dist/chunk-7AL6KAFX.mjs.br +0 -0
- package/dist/chunk-7AL6KAFX.mjs.gz +0 -0
- package/dist/chunk-BBSFZLYI.js.br +0 -0
- package/dist/chunk-BBSFZLYI.js.gz +0 -0
- package/dist/chunk-HHDPQJF3.js.br +0 -0
- package/dist/chunk-HHDPQJF3.js.gz +0 -0
- package/dist/chunk-JCJ3EPG6.mjs.br +0 -0
- package/dist/chunk-KOLCCOTS.mjs.br +0 -0
- package/dist/chunk-KOLCCOTS.mjs.gz +0 -0
- package/dist/chunk-MSRRBA7G.mjs.br +0 -0
- package/dist/chunk-MSRRBA7G.mjs.gz +0 -0
- package/dist/chunk-PPL3WBC7.js.br +0 -0
- package/dist/chunk-PPL3WBC7.js.gz +0 -0
- package/dist/chunk-QA573RUB.js.br +0 -0
- package/dist/chunk-QA573RUB.js.gz +0 -0
- package/dist/chunk-QPHGHUUJ.mjs.br +0 -0
- package/dist/chunk-QPHGHUUJ.mjs.gz +0 -0
- package/dist/chunk-SIM2LXO2.js.br +0 -0
- package/dist/chunk-SIM2LXO2.js.gz +0 -0
- package/dist/chunk-UTIMT5CZ.js.br +0 -0
- package/dist/useViewerBuildingBlocks-f6oNGKMX.d.ts.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SHAPE_PRESET_DEFS, VIEWER_SHORTCUT_REFERENCE, STROKE_DASH_OPTIONS, getAnimationInitialStyle, cloneHistorySnapshot, hasShapeProperties, getImageFitStyle, getComputedFillStyle, isImageLikeElement, getCropShapeClipPath, getImageTilingStyle, mediaPlaybackAttributes, buildTextBlockStyle, hasTextProperties, toCssWritingMode, toCssTextOrientation, toCssVerticalDirection, buildTextBodyLayoutStyle, buildTextBody3DSceneStyle, buildParagraphs, colorWithOpacity, normalizeHexColor, hexToRgbUnit, build3DExtrusionData, getComputedEffectStyle, getComputedStrokeStyle, getAnimationColorBaseStyle, isStrokeOnlyPresetElement, resolveShapeGeometry, normalizeStrokeDashType, getSvgStrokeDasharray, buildSvgGradientDef, buildStrokeOutline, getPresetShapeVectorGeometry, isWedgeCalloutPresetShape, svgGradientFillRef, isCalloutShape, getCalloutLeaderLineGeometry, buildCalloutLeaderLineSvgPath, getCalloutViewBoxBounds, svgLineCap, getCompoundLineOffsets, getCompoundLineWidths, computeSelectionRect, DEFAULT_FONT_FAMILY, cellStyleToCss, rectToCells, isCellInRect, tableContainerCss, buildChartViewModel, resolveChartKind, chartPreserveAspectRatio, buildNotesPdfBytes, buildSlidesPdfBytes, buildPreviewAnimation, buildMotionPathPreview, mediaFallbackVisual, registerCrossSlideAudio, resolveAutoFitFontScale, resolveFontKerning, getSubstituteFontFamily, parsePanoseString, resolveScriptFontSet, hasDistinctScriptFonts, nestedTextDecorationStyle, pieceLetterSpacing, resolveMetricTrackingPx, hollowTextFillStyle, buildTabContext, TEXT_BUILD_ID_SEP, buildTextBuildSpec, textBuildSpanStyle, apply3dEffects, clampUnitInterval, customGeometryPathsToSvgSubpaths, buildSubpathPaints, computeColumnBoundaries, getTableCellBandStyle, parseDrawingColor, parseDrawingColorOpacity, getCellDiagonalBorders, cellRunStyle, getChartStylePalette, computeChartLegendLayout, mediaFallbackIcon, mediaFallbackLabelKey, MEDIA_CHROME_ATTRIBUTE, convertOmmlToMathMl, sanitizeMathMl, tableCellCss, computeResizedColumnWidths, computeResizedRowHeight, DEFAULT_ROW_HEIGHT, ooxmlGradientAngleToCssDegrees, buildRectPathGradient, buildRunTabLines, chartPartToAttrs, splitRunForMetrics, splitRunByScriptFont } from './chunk-
|
|
2
|
-
import { translationsEn } from './chunk-
|
|
1
|
+
import { SHAPE_PRESET_DEFS, VIEWER_SHORTCUT_REFERENCE, STROKE_DASH_OPTIONS, getAnimationInitialStyle, cloneHistorySnapshot, hasShapeProperties, getImageFitStyle, getComputedFillStyle, isImageLikeElement, getCropShapeClipPath, getImageTilingStyle, mediaPlaybackAttributes, buildTextBlockStyle, hasTextProperties, toCssWritingMode, toCssTextOrientation, toCssVerticalDirection, buildTextBodyLayoutStyle, buildTextBody3DSceneStyle, buildParagraphs, colorWithOpacity, normalizeHexColor, hexToRgbUnit, build3DExtrusionData, getComputedEffectStyle, getComputedStrokeStyle, getAnimationColorBaseStyle, isStrokeOnlyPresetElement, resolveShapeGeometry, 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, buildSlidesPdfBytes, buildPreviewAnimation, buildMotionPathPreview, mediaFallbackVisual, scheduleMediaTrimAndFade, registerCrossSlideAudio, resolveAutoFitFontScale, resolveFontKerning, getSubstituteFontFamily, parsePanoseString, resolveScriptFontSet, hasDistinctScriptFonts, nestedTextDecorationStyle, pieceLetterSpacing, resolveMetricTrackingPx, hollowTextFillStyle, stripUnderlineDecoration, buildTabContext, TEXT_BUILD_ID_SEP, buildTextBuildSpec, textBuildSpanStyle, apply3dEffects, clampUnitInterval, customGeometryPathsToSvgSubpaths, buildSubpathPaints, computeColumnBoundaries, getTableCellBandStyle, parseDrawingColor, parseDrawingColorOpacity, getCellDiagonalBorders, 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-ZUSYUWOV.mjs';
|
|
2
|
+
import { translationsEn } from './chunk-TGCSZXOG.mjs';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
import
|
|
5
|
+
import React7, { 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';
|
|
@@ -104,7 +104,7 @@ var SHAPE_PRESETS = SHAPE_PRESET_DEFS.map(
|
|
|
104
104
|
type: def.type,
|
|
105
105
|
label: def.label,
|
|
106
106
|
i18nKey: def.i18nKey,
|
|
107
|
-
icon:
|
|
107
|
+
icon: React7.createElement(GLYPH_COMPONENTS[def.glyph], {
|
|
108
108
|
className: def.glyphClass ? `w-3.5 h-3.5 ${def.glyphClass}` : "w-3.5 h-3.5"
|
|
109
109
|
})
|
|
110
110
|
})
|
|
@@ -330,20 +330,10 @@ function ensureArrayValue(value) {
|
|
|
330
330
|
// src/viewer/utils/media-persistent-audio.tsx
|
|
331
331
|
function buildTrimFragment(element) {
|
|
332
332
|
const start = element.trimStartMs;
|
|
333
|
-
|
|
334
|
-
if (start === void 0 && end === void 0) {
|
|
333
|
+
if (start === void 0 || start <= 0) {
|
|
335
334
|
return "";
|
|
336
335
|
}
|
|
337
|
-
|
|
338
|
-
if (start !== void 0 && start > 0) {
|
|
339
|
-
parts.push((start / 1e3).toFixed(3));
|
|
340
|
-
} else {
|
|
341
|
-
parts.push("");
|
|
342
|
-
}
|
|
343
|
-
if (end !== void 0 && end > 0) {
|
|
344
|
-
parts.push((end / 1e3).toFixed(3));
|
|
345
|
-
}
|
|
346
|
-
return parts.length > 0 ? `#t=${parts.join(",")}` : "";
|
|
336
|
+
return `#t=${(start / 1e3).toFixed(3)}`;
|
|
347
337
|
}
|
|
348
338
|
function useMediaMetadataExtraction(mediaRef, element) {
|
|
349
339
|
const [metadata, setMetadata] = useState(element.metadata);
|
|
@@ -484,25 +474,9 @@ function PresentationMediaController({
|
|
|
484
474
|
}) {
|
|
485
475
|
const { t } = useTranslation();
|
|
486
476
|
const mediaRef = useRef(null);
|
|
487
|
-
const fadeTimerRef = useRef(null);
|
|
488
|
-
const trimTimerRef = useRef(null);
|
|
489
477
|
const [isMediaPlaying, setIsMediaPlaying] = useState(false);
|
|
490
|
-
const volume = element.volume ?? 1;
|
|
491
|
-
const fadeIn = element.fadeInDuration ?? 0;
|
|
492
|
-
const fadeOut = element.fadeOutDuration ?? 0;
|
|
493
478
|
const trimStartSec = element.trimStartMs !== void 0 ? element.trimStartMs / 1e3 : 0;
|
|
494
|
-
const trimEndSec = element.trimEndMs !== void 0 && element.trimEndMs > 0 ? element.trimEndMs / 1e3 : 0;
|
|
495
479
|
const hideWhenNotPlaying = isPresentationMode && element.hideWhenNotPlaying === true;
|
|
496
|
-
useEffect(() => {
|
|
497
|
-
return () => {
|
|
498
|
-
if (fadeTimerRef.current !== null) {
|
|
499
|
-
cancelAnimationFrame(fadeTimerRef.current);
|
|
500
|
-
}
|
|
501
|
-
if (trimTimerRef.current !== null) {
|
|
502
|
-
window.clearTimeout(trimTimerRef.current);
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
}, []);
|
|
506
480
|
const { volume: playbackVolume, playbackRate } = mediaPlaybackAttributes({
|
|
507
481
|
loop: element.loop,
|
|
508
482
|
volume: element.volume,
|
|
@@ -525,7 +499,7 @@ function PresentationMediaController({
|
|
|
525
499
|
if (!el) {
|
|
526
500
|
return;
|
|
527
501
|
}
|
|
528
|
-
const
|
|
502
|
+
const handlePlay = () => {
|
|
529
503
|
setIsMediaPlaying(true);
|
|
530
504
|
onPlayStateChange?.(true);
|
|
531
505
|
};
|
|
@@ -537,101 +511,35 @@ function PresentationMediaController({
|
|
|
537
511
|
setIsMediaPlaying(false);
|
|
538
512
|
onPlayStateChange?.(false);
|
|
539
513
|
};
|
|
540
|
-
el.addEventListener("play",
|
|
514
|
+
el.addEventListener("play", handlePlay);
|
|
541
515
|
el.addEventListener("pause", handlePause);
|
|
542
516
|
el.addEventListener("ended", handleEnded);
|
|
543
517
|
return () => {
|
|
544
|
-
el.removeEventListener("play",
|
|
518
|
+
el.removeEventListener("play", handlePlay);
|
|
545
519
|
el.removeEventListener("pause", handlePause);
|
|
546
520
|
el.removeEventListener("ended", handleEnded);
|
|
547
521
|
};
|
|
548
522
|
}, [onPlayStateChange]);
|
|
549
|
-
|
|
550
|
-
const el = mediaRef.current;
|
|
551
|
-
if (!el || fadeIn <= 0) {
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
554
|
-
const startTime = performance.now();
|
|
555
|
-
const durationMs = fadeIn * 1e3;
|
|
556
|
-
el.volume = 0;
|
|
557
|
-
const tick = () => {
|
|
558
|
-
const elapsed = performance.now() - startTime;
|
|
559
|
-
const progress = Math.min(1, elapsed / durationMs);
|
|
560
|
-
el.volume = progress * volume;
|
|
561
|
-
if (progress < 1) {
|
|
562
|
-
fadeTimerRef.current = requestAnimationFrame(tick);
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
fadeTimerRef.current = requestAnimationFrame(tick);
|
|
566
|
-
}, [fadeIn, volume]);
|
|
567
|
-
const handlePlay = useCallback(() => {
|
|
523
|
+
useEffect(() => {
|
|
568
524
|
const el = mediaRef.current;
|
|
569
525
|
if (!el || !isPresentationMode) {
|
|
570
526
|
return;
|
|
571
527
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
const fadeOutTick = () => {
|
|
588
|
-
const elapsed = performance.now() - fadeStartTime;
|
|
589
|
-
const progress = Math.min(1, elapsed / fadeMs);
|
|
590
|
-
el.volume = startVol * (1 - progress);
|
|
591
|
-
if (progress < 1 && !el.paused) {
|
|
592
|
-
fadeTimerRef.current = requestAnimationFrame(fadeOutTick);
|
|
593
|
-
}
|
|
594
|
-
};
|
|
595
|
-
fadeTimerRef.current = requestAnimationFrame(fadeOutTick);
|
|
596
|
-
}, fadeOutStart);
|
|
597
|
-
}
|
|
598
|
-
const stopTimer = window.setTimeout(() => {
|
|
599
|
-
if (!el.paused) {
|
|
600
|
-
el.pause();
|
|
601
|
-
el.currentTime = trimEndSec;
|
|
602
|
-
}
|
|
603
|
-
}, remaining * 1e3);
|
|
604
|
-
const prevTimer = trimTimerRef.current;
|
|
605
|
-
trimTimerRef.current = stopTimer;
|
|
606
|
-
if (prevTimer !== null) {
|
|
607
|
-
window.clearTimeout(prevTimer);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
} else if (fadeOut > 0) {
|
|
611
|
-
const handleTimeUpdate = () => {
|
|
612
|
-
if (!Number.isFinite(el.duration)) {
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
const timeLeft = el.duration - el.currentTime;
|
|
616
|
-
if (timeLeft <= fadeOut && timeLeft > 0) {
|
|
617
|
-
el.removeEventListener("timeupdate", handleTimeUpdate);
|
|
618
|
-
const fadeStartTime = performance.now();
|
|
619
|
-
const fadeMs = timeLeft * 1e3;
|
|
620
|
-
const startVol = el.volume;
|
|
621
|
-
const fadeOutTick = () => {
|
|
622
|
-
const elapsed = performance.now() - fadeStartTime;
|
|
623
|
-
const progress = Math.min(1, elapsed / fadeMs);
|
|
624
|
-
el.volume = startVol * (1 - progress);
|
|
625
|
-
if (progress < 1 && !el.paused) {
|
|
626
|
-
fadeTimerRef.current = requestAnimationFrame(fadeOutTick);
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
fadeTimerRef.current = requestAnimationFrame(fadeOutTick);
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
el.addEventListener("timeupdate", handleTimeUpdate);
|
|
633
|
-
}
|
|
634
|
-
}, [applyFadeIn, fadeIn, fadeOut, isPresentationMode, trimEndSec, trimStartSec]);
|
|
528
|
+
return scheduleMediaTrimAndFade(el, {
|
|
529
|
+
trimStartMs: element.trimStartMs,
|
|
530
|
+
trimEndMs: element.trimEndMs,
|
|
531
|
+
fadeInDuration: element.fadeInDuration,
|
|
532
|
+
fadeOutDuration: element.fadeOutDuration,
|
|
533
|
+
volume: playbackVolume
|
|
534
|
+
});
|
|
535
|
+
}, [
|
|
536
|
+
isPresentationMode,
|
|
537
|
+
element.trimStartMs,
|
|
538
|
+
element.trimEndMs,
|
|
539
|
+
element.fadeInDuration,
|
|
540
|
+
element.fadeOutDuration,
|
|
541
|
+
playbackVolume
|
|
542
|
+
]);
|
|
635
543
|
useEffect(() => {
|
|
636
544
|
if (!isPresentationMode || !shouldAutoPlay) {
|
|
637
545
|
return;
|
|
@@ -666,8 +574,10 @@ function PresentationMediaController({
|
|
|
666
574
|
el.pause();
|
|
667
575
|
}
|
|
668
576
|
}, []);
|
|
577
|
+
const noopOnPlay = useCallback(() => {
|
|
578
|
+
}, []);
|
|
669
579
|
return /* @__PURE__ */ jsxs("div", { className: "w-full h-full", style: wrapperStyle, children: [
|
|
670
|
-
children({ mediaRef, onPlay:
|
|
580
|
+
children({ mediaRef, onPlay: noopOnPlay, isMediaPlaying }),
|
|
671
581
|
isFullScreen && isPresentationMode && isMediaPlaying && /* @__PURE__ */ jsx(
|
|
672
582
|
"button",
|
|
673
583
|
{
|
|
@@ -1130,7 +1040,7 @@ function wrapWithTextBuildAnimation(elementId, paraIndex, renderedSegments, para
|
|
|
1130
1040
|
return spec.spans.map((span, index) => {
|
|
1131
1041
|
const content = span.style && renderPiece ? renderPiece(span.style, span.text, String(index)) : span.text;
|
|
1132
1042
|
if (!span.animId) {
|
|
1133
|
-
return /* @__PURE__ */ jsx(
|
|
1043
|
+
return /* @__PURE__ */ jsx(React7.Fragment, { children: content }, `ws-${index}`);
|
|
1134
1044
|
}
|
|
1135
1045
|
return /* @__PURE__ */ jsx(
|
|
1136
1046
|
"span",
|
|
@@ -1143,11 +1053,53 @@ function wrapWithTextBuildAnimation(elementId, paraIndex, renderedSegments, para
|
|
|
1143
1053
|
);
|
|
1144
1054
|
});
|
|
1145
1055
|
}
|
|
1056
|
+
function renderUnderlineWords(text, isUnderlineWords, wordDecoration, metric, keyPrefix, inner) {
|
|
1057
|
+
if (!isUnderlineWords || !text) {
|
|
1058
|
+
return inner(text, keyPrefix, metric);
|
|
1059
|
+
}
|
|
1060
|
+
const pieces = splitWordsForUnderline(text);
|
|
1061
|
+
if (pieces.length === 0) {
|
|
1062
|
+
return inner(text, keyPrefix, metric);
|
|
1063
|
+
}
|
|
1064
|
+
const gapMetric = metric ? {
|
|
1065
|
+
...metric,
|
|
1066
|
+
nestedStyle: metric.nestedStyle ? stripUnderlineDecoration(metric.nestedStyle) : void 0
|
|
1067
|
+
} : void 0;
|
|
1068
|
+
return pieces.map((piece, i) => {
|
|
1069
|
+
const key = `${keyPrefix}-u${i}`;
|
|
1070
|
+
if (!piece.underline) {
|
|
1071
|
+
return /* @__PURE__ */ jsx(React7.Fragment, { children: inner(piece.text, key, gapMetric) }, key);
|
|
1072
|
+
}
|
|
1073
|
+
return /* @__PURE__ */ jsx("span", { style: wordDecoration, children: inner(piece.text, key, metric) }, key);
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
function makeSegmentPieceRenderer(needsScriptFonts, scriptFonts, baseFontFamily, isUnderlineWords, wordDecoration, metric) {
|
|
1077
|
+
return (text, key) => renderUnderlineWords(
|
|
1078
|
+
text,
|
|
1079
|
+
isUnderlineWords,
|
|
1080
|
+
wordDecoration,
|
|
1081
|
+
metric,
|
|
1082
|
+
key,
|
|
1083
|
+
(subText, subKey, subMetric) => renderMetricPieces(
|
|
1084
|
+
subText,
|
|
1085
|
+
subMetric,
|
|
1086
|
+
subKey,
|
|
1087
|
+
(pieceText, pieceKey) => renderScriptAwareText(
|
|
1088
|
+
pieceText,
|
|
1089
|
+
needsScriptFonts,
|
|
1090
|
+
scriptFonts,
|
|
1091
|
+
baseFontFamily,
|
|
1092
|
+
pieceKey,
|
|
1093
|
+
subMetric?.nestedStyle
|
|
1094
|
+
)
|
|
1095
|
+
)
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1146
1098
|
function renderTabbedLine(line, ctx, keyPrefix, renderPiece, nestedStyle) {
|
|
1147
1099
|
const [lineLayout] = buildRunTabLines(line, ctx, nestedStyle);
|
|
1148
1100
|
return /* @__PURE__ */ jsx("span", { style: { display: "inline-block", whiteSpace: "nowrap" }, children: lineLayout.pieces.map((piece, i) => {
|
|
1149
1101
|
const key = `${keyPrefix}-tab-${i}`;
|
|
1150
|
-
return /* @__PURE__ */ jsxs(
|
|
1102
|
+
return /* @__PURE__ */ jsxs(React7.Fragment, { children: [
|
|
1151
1103
|
piece.leaderStyle ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: piece.leaderStyle, children: piece.leaderText }) : null,
|
|
1152
1104
|
/* @__PURE__ */ jsx("span", { style: piece.style, children: renderPiece(piece.text, key) })
|
|
1153
1105
|
] }, key);
|
|
@@ -1167,7 +1119,7 @@ function renderScriptAwareText(text, needsScriptFonts, scriptFonts, baseFontFami
|
|
|
1167
1119
|
return text;
|
|
1168
1120
|
}
|
|
1169
1121
|
return pieces.map(
|
|
1170
|
-
(piece, i) => piece.style ? /* @__PURE__ */ jsx("span", { style: piece.style, children: piece.text }, `${keyPrefix}-r${i}`) : /* @__PURE__ */ jsx(
|
|
1122
|
+
(piece, i) => piece.style ? /* @__PURE__ */ jsx("span", { style: piece.style, children: piece.text }, `${keyPrefix}-r${i}`) : /* @__PURE__ */ jsx(React7.Fragment, { children: piece.text }, `${keyPrefix}-r${i}`)
|
|
1171
1123
|
);
|
|
1172
1124
|
}
|
|
1173
1125
|
function renderMetricPieces(text, metric, keyPrefix, inner) {
|
|
@@ -1190,26 +1142,21 @@ function renderMetricPieces(text, metric, keyPrefix, inner) {
|
|
|
1190
1142
|
`${keyPrefix}-w${i}`
|
|
1191
1143
|
));
|
|
1192
1144
|
}
|
|
1193
|
-
function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsScriptFonts, scriptFonts, baseFontFamily, findHighlights, tabContext, metric) {
|
|
1145
|
+
function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsScriptFonts, scriptFonts, baseFontFamily, findHighlights, tabContext, metric, isUnderlineWords = false, wordDecoration) {
|
|
1194
1146
|
const segHl = findHighlights?.get(segmentIndex);
|
|
1147
|
+
const renderLeaf = makeSegmentPieceRenderer(
|
|
1148
|
+
needsScriptFonts,
|
|
1149
|
+
scriptFonts,
|
|
1150
|
+
baseFontFamily,
|
|
1151
|
+
isUnderlineWords,
|
|
1152
|
+
wordDecoration,
|
|
1153
|
+
metric
|
|
1154
|
+
);
|
|
1195
1155
|
if (!segHl || segHl.length === 0) {
|
|
1196
1156
|
return lines.map((line, lineIndex) => {
|
|
1197
1157
|
const lineKey = `${elementId}-seg-${segmentIndex}-line-${lineIndex}`;
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
metric,
|
|
1201
|
-
key,
|
|
1202
|
-
(pieceText, pieceKey) => renderScriptAwareText(
|
|
1203
|
-
pieceText,
|
|
1204
|
-
needsScriptFonts,
|
|
1205
|
-
scriptFonts,
|
|
1206
|
-
baseFontFamily,
|
|
1207
|
-
pieceKey,
|
|
1208
|
-
metric?.nestedStyle
|
|
1209
|
-
)
|
|
1210
|
-
);
|
|
1211
|
-
return /* @__PURE__ */ jsxs(React6.Fragment, { children: [
|
|
1212
|
-
tabContext && line.includes(" ") ? renderTabbedLine(line, tabContext, lineKey, renderPiece, metric?.nestedStyle) : renderPiece(line, lineKey),
|
|
1158
|
+
return /* @__PURE__ */ jsxs(React7.Fragment, { children: [
|
|
1159
|
+
tabContext && line.includes(" ") ? renderTabbedLine(line, tabContext, lineKey, renderLeaf, metric?.nestedStyle) : renderLeaf(line, lineKey),
|
|
1213
1160
|
lineIndex < lines.length - 1 ? /* @__PURE__ */ jsx("br", {}) : null
|
|
1214
1161
|
] }, lineKey);
|
|
1215
1162
|
});
|
|
@@ -1239,19 +1186,6 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
1239
1186
|
isCurrent: false
|
|
1240
1187
|
});
|
|
1241
1188
|
}
|
|
1242
|
-
const renderChunk = (text, key) => renderMetricPieces(
|
|
1243
|
-
text,
|
|
1244
|
-
metric,
|
|
1245
|
-
key,
|
|
1246
|
-
(pieceText, pieceKey) => renderScriptAwareText(
|
|
1247
|
-
pieceText,
|
|
1248
|
-
needsScriptFonts,
|
|
1249
|
-
scriptFonts,
|
|
1250
|
-
baseFontFamily,
|
|
1251
|
-
pieceKey,
|
|
1252
|
-
metric?.nestedStyle
|
|
1253
|
-
)
|
|
1254
|
-
);
|
|
1255
1189
|
return chunks.map((chunk, ci) => {
|
|
1256
1190
|
const chunkKey = `${elementId}-seg-${segmentIndex}-hl-${ci}`;
|
|
1257
1191
|
return chunk.highlighted ? /* @__PURE__ */ jsx(
|
|
@@ -1263,10 +1197,10 @@ function renderSegmentContent(elementId, segmentIndex, textValue, lines, needsSc
|
|
|
1263
1197
|
color: "inherit",
|
|
1264
1198
|
borderRadius: 2
|
|
1265
1199
|
},
|
|
1266
|
-
children:
|
|
1200
|
+
children: renderLeaf(chunk.text, chunkKey)
|
|
1267
1201
|
},
|
|
1268
1202
|
chunkKey
|
|
1269
|
-
) : /* @__PURE__ */ jsx(
|
|
1203
|
+
) : /* @__PURE__ */ jsx(React7.Fragment, { children: renderLeaf(chunk.text, chunkKey) }, chunkKey);
|
|
1270
1204
|
});
|
|
1271
1205
|
}
|
|
1272
1206
|
function renderEquationSegment(elementId, segmentIndex, equationXml, equationNumber) {
|
|
@@ -1328,11 +1262,12 @@ function renderHyperlink(run, spanNode, key, ctx) {
|
|
|
1328
1262
|
}
|
|
1329
1263
|
const requireCtrlClick = ctx.requireCtrlClick;
|
|
1330
1264
|
const displayUrl = url.startsWith("ppaction://") ? url.replace(/^ppaction:\/\//u, "").split("?")[0] : url;
|
|
1265
|
+
const targetFrame = run.hyperlink?.target;
|
|
1331
1266
|
const follow = (modified) => {
|
|
1332
1267
|
if (requireCtrlClick && !modified) {
|
|
1333
1268
|
return false;
|
|
1334
1269
|
}
|
|
1335
|
-
onHyperlinkClick(url);
|
|
1270
|
+
onHyperlinkClick(url, targetFrame);
|
|
1336
1271
|
return true;
|
|
1337
1272
|
};
|
|
1338
1273
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1448,6 +1383,16 @@ function renderParagraphRun(run, segment, ctx, keySuffix = "") {
|
|
|
1448
1383
|
spanStyle.direction = runRtl ? "rtl" : "ltr";
|
|
1449
1384
|
spanStyle.unicodeBidi = runRtl !== ctx.paragraphRtl ? "bidi-override" : "embed";
|
|
1450
1385
|
}
|
|
1386
|
+
const isUnderlineWords = Boolean(segmentStyle.underline) && segmentStyle.underlineStyle === "words";
|
|
1387
|
+
const wordDecoration = isUnderlineWords ? nestedStyle : void 0;
|
|
1388
|
+
if (isUnderlineWords) {
|
|
1389
|
+
const stripped = stripUnderlineDecoration(spanStyle);
|
|
1390
|
+
spanStyle.textDecoration = stripped.textDecoration;
|
|
1391
|
+
delete spanStyle.textDecorationStyle;
|
|
1392
|
+
delete spanStyle.textDecorationThickness;
|
|
1393
|
+
delete spanStyle.textUnderlineOffset;
|
|
1394
|
+
delete spanStyle.textDecorationColor;
|
|
1395
|
+
}
|
|
1451
1396
|
const baseContent = renderSegmentContent(
|
|
1452
1397
|
element.id,
|
|
1453
1398
|
segmentIndex,
|
|
@@ -1465,7 +1410,9 @@ function renderParagraphRun(run, segment, ctx, keySuffix = "") {
|
|
|
1465
1410
|
Boolean(segmentStyle.bold),
|
|
1466
1411
|
Boolean(segmentStyle.italic)
|
|
1467
1412
|
),
|
|
1468
|
-
metricContext
|
|
1413
|
+
metricContext,
|
|
1414
|
+
isUnderlineWords,
|
|
1415
|
+
wordDecoration
|
|
1469
1416
|
);
|
|
1470
1417
|
const spanNode = /* @__PURE__ */ jsx("span", { "data-seg-idx": segmentIndex, style: spanStyle, children: renderRubyOrText(run, baseContent) }, key);
|
|
1471
1418
|
const reflectedNode = wrapWithTextReflection(run, key, spanNode, spanStyle, baseContent);
|
|
@@ -1570,7 +1517,7 @@ function renderParagraph(para, paraIndex, paraCount, segments, ctx, subElementAn
|
|
|
1570
1517
|
);
|
|
1571
1518
|
const needsWrapper = Object.keys(paraStyle).length > 0 || marker !== null;
|
|
1572
1519
|
if (!needsWrapper) {
|
|
1573
|
-
return /* @__PURE__ */ jsxs(
|
|
1520
|
+
return /* @__PURE__ */ jsxs(React7.Fragment, { children: [
|
|
1574
1521
|
wrappedContent,
|
|
1575
1522
|
paraIndex < paraCount - 1 ? /* @__PURE__ */ jsx("br", {}) : null
|
|
1576
1523
|
] }, `${element.id}-para-${paraIndex}`);
|
|
@@ -3143,7 +3090,7 @@ function renderTableFromTableData(element, textStyle, options) {
|
|
|
3143
3090
|
const rowCount = tableData.rows.length;
|
|
3144
3091
|
const columnCount = tableData.columnWidths.length;
|
|
3145
3092
|
const selectedCell = options?.selectedCell || null;
|
|
3146
|
-
const isEditable = Boolean(options?.editable);
|
|
3093
|
+
const isEditable = Boolean(options?.editable) && canDrillDown(element);
|
|
3147
3094
|
const hasCellSelectionHandler = typeof options?.onSelectCell === "function";
|
|
3148
3095
|
const sharedCtx = {
|
|
3149
3096
|
tableStyleMap: options?.styleCtx?.tableStyleMap,
|
|
@@ -3308,7 +3255,7 @@ function renderTableElement(element, textStyle, options) {
|
|
|
3308
3255
|
return /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none", children: translationsEn["pptx.table.title"] });
|
|
3309
3256
|
}
|
|
3310
3257
|
const selectedCell = options?.selectedCell || null;
|
|
3311
|
-
const isEditable = Boolean(options?.editable);
|
|
3258
|
+
const isEditable = Boolean(options?.editable) && canDrillDown(element);
|
|
3312
3259
|
const hasCellSelectionHandler = typeof options?.onSelectCell === "function";
|
|
3313
3260
|
const tableEl = element;
|
|
3314
3261
|
const xmlSelectionRect = (() => {
|
|
@@ -3664,16 +3611,50 @@ function renderChartViewModel(elementId, vm, preserveAspectRatio = "none") {
|
|
|
3664
3611
|
viewBox: `0 0 ${vm.svgWidth} ${vm.svgHeight}`,
|
|
3665
3612
|
preserveAspectRatio,
|
|
3666
3613
|
children: [
|
|
3667
|
-
vm.
|
|
3614
|
+
vm.defs && vm.defs.length > 0 && /* @__PURE__ */ jsx("defs", { children: vm.defs.map((def, i) => /* @__PURE__ */ jsx(
|
|
3615
|
+
"pattern",
|
|
3616
|
+
{
|
|
3617
|
+
id: def.id,
|
|
3618
|
+
patternUnits: def.patternUnits,
|
|
3619
|
+
x: def.x,
|
|
3620
|
+
y: def.y,
|
|
3621
|
+
width: def.width,
|
|
3622
|
+
height: def.height,
|
|
3623
|
+
children: /* @__PURE__ */ jsx(
|
|
3624
|
+
"image",
|
|
3625
|
+
{
|
|
3626
|
+
href: def.href,
|
|
3627
|
+
x: 0,
|
|
3628
|
+
y: 0,
|
|
3629
|
+
width: def.width,
|
|
3630
|
+
height: def.height,
|
|
3631
|
+
preserveAspectRatio: def.preserveAspectRatio
|
|
3632
|
+
}
|
|
3633
|
+
)
|
|
3634
|
+
},
|
|
3635
|
+
`${elementId}-def-${i}`
|
|
3636
|
+
)) }),
|
|
3637
|
+
vm.areaFill && /* @__PURE__ */ jsx(
|
|
3638
|
+
"rect",
|
|
3639
|
+
{
|
|
3640
|
+
x: 0,
|
|
3641
|
+
y: 0,
|
|
3642
|
+
width: vm.svgWidth,
|
|
3643
|
+
height: vm.svgHeight,
|
|
3644
|
+
rx: vm.areaRadius,
|
|
3645
|
+
fill: vm.areaFill
|
|
3646
|
+
}
|
|
3647
|
+
),
|
|
3668
3648
|
vm.title && /* @__PURE__ */ jsx(
|
|
3669
3649
|
"text",
|
|
3670
3650
|
{
|
|
3671
3651
|
x: vm.titleX,
|
|
3672
3652
|
y: vm.titleY,
|
|
3673
3653
|
textAnchor: "middle",
|
|
3674
|
-
fontSize: 12,
|
|
3675
|
-
fontWeight: 600,
|
|
3676
|
-
|
|
3654
|
+
fontSize: vm.titleStyle?.fontSize ?? 12,
|
|
3655
|
+
fontWeight: vm.titleStyle?.fontWeight ?? 600,
|
|
3656
|
+
fontFamily: vm.titleStyle?.fontFamily,
|
|
3657
|
+
fill: vm.titleStyle?.fill ?? "#1e293b",
|
|
3677
3658
|
"data-chart-part": "title",
|
|
3678
3659
|
children: vm.title
|
|
3679
3660
|
}
|
|
Binary file
|
|
Binary file
|