pptx-react-viewer 1.23.0 → 1.24.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +27 -0
  3. package/dist/{Model3DScene-4XNBDASE.mjs → Model3DScene-QTNGCODM.mjs} +2 -2
  4. package/dist/Model3DScene-QTNGCODM.mjs.br +0 -0
  5. package/dist/Model3DScene-QTNGCODM.mjs.gz +0 -0
  6. package/dist/{Model3DScene-AQS7KDM4.js → Model3DScene-RD4XEC3F.js} +3 -3
  7. package/dist/Model3DScene-RD4XEC3F.js.br +0 -0
  8. package/dist/Model3DScene-RD4XEC3F.js.gz +0 -0
  9. package/dist/{PowerPointViewer-DFTatVS4.d.ts → PowerPointViewer-CnADroqZ.d.ts} +2 -2
  10. package/dist/{PowerPointViewer-DFTatVS4.d.ts.map → PowerPointViewer-CnADroqZ.d.ts.map} +1 -1
  11. package/dist/{SurfaceChart3DScene-K7ZDXDBL.mjs → SurfaceChart3DScene-VKS3ELTU.mjs} +2 -2
  12. package/dist/SurfaceChart3DScene-VKS3ELTU.mjs.br +0 -0
  13. package/dist/SurfaceChart3DScene-VKS3ELTU.mjs.gz +0 -0
  14. package/dist/{SurfaceChart3DScene-HA2SD6BY.js → SurfaceChart3DScene-YR3GX4X6.js} +3 -3
  15. package/dist/SurfaceChart3DScene-YR3GX4X6.js.br +0 -0
  16. package/dist/SurfaceChart3DScene-YR3GX4X6.js.gz +0 -0
  17. package/dist/{types-Da1M5VBY.d.ts → animation-timeline-CEJJLFqK.d.ts} +3 -3
  18. package/dist/animation-timeline-CEJJLFqK.d.ts.map +1 -0
  19. package/dist/{chunk-LS2AIX2H.js → chunk-3YMK5VLS.js} +26707 -26744
  20. package/dist/chunk-3YMK5VLS.js.br +0 -0
  21. package/dist/chunk-3YMK5VLS.js.gz +0 -0
  22. package/dist/{chunk-H5RREYCO.js → chunk-GKST4OS7.js} +1270 -454
  23. package/dist/chunk-GKST4OS7.js.br +0 -0
  24. package/dist/chunk-GKST4OS7.js.gz +0 -0
  25. package/dist/{chunk-2DXNTVFV.js → chunk-I5SO5OV4.js} +69 -71
  26. package/dist/chunk-I5SO5OV4.js.br +0 -0
  27. package/dist/chunk-I5SO5OV4.js.gz +0 -0
  28. package/dist/{chunk-I42XL2WU.mjs → chunk-KPT54MHG.mjs} +40 -42
  29. package/dist/chunk-KPT54MHG.mjs.br +0 -0
  30. package/dist/chunk-KPT54MHG.mjs.gz +0 -0
  31. package/dist/{chunk-MS6S6YYR.js → chunk-KV3EOLP3.js} +50785 -50553
  32. package/dist/chunk-KV3EOLP3.js.br +0 -0
  33. package/dist/chunk-KV3EOLP3.js.gz +0 -0
  34. package/dist/{chunk-AFWMAFWR.mjs → chunk-LDZQNYWL.mjs} +50784 -50554
  35. package/dist/chunk-LDZQNYWL.mjs.br +0 -0
  36. package/dist/chunk-LDZQNYWL.mjs.gz +0 -0
  37. package/dist/{chunk-36NC56XG.mjs → chunk-PUQ6GIOM.mjs} +26099 -26138
  38. package/dist/chunk-PUQ6GIOM.mjs.br +0 -0
  39. package/dist/chunk-PUQ6GIOM.mjs.gz +0 -0
  40. package/dist/{chunk-LFEVG3ED.mjs → chunk-YJVMOX2Y.mjs} +819 -5
  41. package/dist/chunk-YJVMOX2Y.mjs.br +0 -0
  42. package/dist/chunk-YJVMOX2Y.mjs.gz +0 -0
  43. package/dist/{dist-5KQQ6GP2.mjs → dist-A3OATMOE.mjs} +1 -1
  44. package/dist/dist-A3OATMOE.mjs.br +0 -0
  45. package/dist/dist-A3OATMOE.mjs.gz +0 -0
  46. package/dist/{dist-CVSSAFDL.js → dist-XF3QJAEF.js} +568 -560
  47. package/dist/dist-XF3QJAEF.js.br +0 -0
  48. package/dist/dist-XF3QJAEF.js.gz +0 -0
  49. package/dist/hooks-unstable.d.ts +407 -37
  50. package/dist/hooks-unstable.d.ts.map +1 -1
  51. package/dist/hooks-unstable.js +80 -76
  52. package/dist/hooks-unstable.js.br +0 -0
  53. package/dist/hooks-unstable.js.gz +0 -0
  54. package/dist/hooks-unstable.mjs +3 -3
  55. package/dist/hooks-unstable.mjs.br +0 -0
  56. package/dist/hooks-unstable.mjs.gz +0 -0
  57. package/dist/{index-COgh2UTL.d.ts → index-hm2FF-FU.d.ts} +3 -3
  58. package/dist/{index-COgh2UTL.d.ts.map → index-hm2FF-FU.d.ts.map} +1 -1
  59. package/dist/index.d.ts +865 -7
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +42 -30
  62. package/dist/index.js.br +0 -0
  63. package/dist/index.js.gz +0 -0
  64. package/dist/index.mjs +4 -4
  65. package/dist/index.mjs.br +0 -0
  66. package/dist/index.mjs.gz +0 -0
  67. package/dist/useViewerBuildingBlocks-ll3_ncCH.d.ts +378 -0
  68. package/dist/useViewerBuildingBlocks-ll3_ncCH.d.ts.map +1 -0
  69. package/dist/viewer/index.js +20 -20
  70. package/dist/viewer/index.js.br +0 -0
  71. package/dist/viewer/index.js.gz +0 -0
  72. package/dist/viewer/index.mjs +4 -4
  73. package/dist/viewer/index.mjs.br +0 -0
  74. package/dist/viewer/index.mjs.gz +0 -0
  75. package/package.json +1 -1
  76. package/dist/Model3DScene-4XNBDASE.mjs.br +0 -0
  77. package/dist/Model3DScene-4XNBDASE.mjs.gz +0 -0
  78. package/dist/Model3DScene-AQS7KDM4.js.br +0 -0
  79. package/dist/Model3DScene-AQS7KDM4.js.gz +0 -0
  80. package/dist/SurfaceChart3DScene-HA2SD6BY.js.br +0 -0
  81. package/dist/SurfaceChart3DScene-HA2SD6BY.js.gz +0 -0
  82. package/dist/SurfaceChart3DScene-K7ZDXDBL.mjs.br +0 -0
  83. package/dist/SurfaceChart3DScene-K7ZDXDBL.mjs.gz +0 -0
  84. package/dist/chunk-2DXNTVFV.js.br +0 -0
  85. package/dist/chunk-2DXNTVFV.js.gz +0 -0
  86. package/dist/chunk-36NC56XG.mjs.br +0 -0
  87. package/dist/chunk-36NC56XG.mjs.gz +0 -0
  88. package/dist/chunk-AFWMAFWR.mjs.br +0 -0
  89. package/dist/chunk-AFWMAFWR.mjs.gz +0 -0
  90. package/dist/chunk-H5RREYCO.js.br +0 -0
  91. package/dist/chunk-H5RREYCO.js.gz +0 -0
  92. package/dist/chunk-I42XL2WU.mjs.br +0 -0
  93. package/dist/chunk-I42XL2WU.mjs.gz +0 -0
  94. package/dist/chunk-LFEVG3ED.mjs.br +0 -0
  95. package/dist/chunk-LFEVG3ED.mjs.gz +0 -0
  96. package/dist/chunk-LS2AIX2H.js.br +0 -0
  97. package/dist/chunk-LS2AIX2H.js.gz +0 -0
  98. package/dist/chunk-MS6S6YYR.js.br +0 -0
  99. package/dist/chunk-MS6S6YYR.js.gz +0 -0
  100. package/dist/dist-5KQQ6GP2.mjs.br +0 -0
  101. package/dist/dist-5KQQ6GP2.mjs.gz +0 -0
  102. package/dist/dist-CVSSAFDL.js.br +0 -0
  103. package/dist/dist-CVSSAFDL.js.gz +0 -0
  104. package/dist/types-Da1M5VBY.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
- import { SHAPE_PRESET_DEFS, TOOLBAR_TABS, computeValueRangeForChart, cloneTemplateElementsBySlideId, cloneSlide, countTextSegments, expandTextBuildAnimations, TimelineEngine, TEXT_BUILD_ID_SEP, computeEntranceAnimationDelay, storePresentationDeck, loadPresentationDeck, clearPresentationDeck, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, isPresentationSessionMessage, collectMediaElements, collectImagePaths, buildInitialGuides, saveAutosaveSnapshot, getAnimationInitialStyle, normalizeHexColor, toCssWritingMode, toCssTextOrientation, toCssVerticalDirection, computeAutoFitTextStyle, resolveLineHeight, getKinsokuLineBreakStyles, buildTextBody3DSceneStyle, resolveParagraphRtl, resolveParagraphAlign, resolveCssTextAlign, colorWithOpacity, build3DExtrusionData, getResolvedShapeClipPath, normalizeStrokeDashType, buildCssGradientFromShapeStyle, buildShadowCssFromShapeStyle, buildInnerShadowCssFromShapeStyle, buildMultiLayerShadowCss, buildGlowBoxShadow, getCompoundLineBoxShadow, getEffectDagFilter, buildPatternFillCss, buildReflectionCss, getCssBorderDashStyle, getCompoundLineBorderWidth, getSvgStrokeDasharray, getCompoundLineOffsets, getCompoundLineWidths, clampCropValue, computeSelectionRect, rectToCells, isCellInRect, buildChartViewModel, buildPreviewAnimation, isTemplateElementId, getInlineEditorSelection, applyStyleToSelectedSegments, setPendingSelectionRestore, applyCaseTransformToSegments, transformTextCase, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, normalizeColorsForCapture, preprocessCssForCapture, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, recordProgressPercent, comparePresentation, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, detectTouchDevice, detectOrientation, isMobileViewport, MOBILE_BREAKPOINT, TABLET_BREAKPOINT, remapTextToSegments, shouldLoopContinuously, applyRehearsalTimings, copyFormatFromElement, applyFormatToElement, createSyncGate, validateRoomId, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, BROADCAST_THROTTLE_MS, sanitizeColor, readSlidesFromYDoc, reconcileSlidesInYDoc, LOCAL_SYNC_ORIGIN, observeYDocSlides, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, createTouchGestureRecognizer, isKeyboardOpen, isActionHidden, buildElementClipboardPayload, generatePackageReadme, downloadBlob, groupElements, generateElementId, makeCloneId, alignElements, distributeElements, bringForward, sendBackward, bringToFront, sendToBack, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, derivePresenceList, buildPrintDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, makeSlideId, cloneHistorySnapshot, createPresentationSessionId, resolveTransitionDurationMs, isUrlSafe, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, presenterElapsed, stepPresenterZoom, resetPresenterTimer, togglePresenterTimer, isTemplateElement, substituteFieldText, resolveUnderlineDecorationStyle, hasDistinctScriptFonts, buildTextReflectionCss, getTextAlphaOpacity, buildTextRunFilterChain, buildTextShadowCss, apply3dEffects, clampUnitInterval, getRoundRectRadiusPx, computeColumnBoundaries, parseDrawingColor, parseDrawingColorOpacity, getPatternSvg, ooxmlDashToCssBorderStyle, getChartStylePalette, computeLayout, valueToY, formatAxisValue, computeLayoutOptions, splitSeriesByAxis, computeValueRange, getSecondaryValueAxis, seriesColor, paletteColor, resolveRegionCode, normalizeValue, sequentialColorScale, canvasToJpegData, downloadDataUrl, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, sanitizeDownloadFilename, encodeGif, groupSlidesBySection, cloneElementForPaste, computeScrollDelta, rerouteConnectorsForMovedElements, applyReroutedConnectors, buildPrintHtmlDocument, convertOmmlToMathMl, sanitizeMathMl, buildTextFillCss, resolvePictureBullet, computeResizedColumnWidths, computeResizedRowHeight, DEFAULT_ROW_HEIGHT, tintColor2, shadeColor2, deleteTableColumn, insertTableColumn, deleteTableRow, insertTableRow, splitCell, mergeCells, buildSlidesPdfBytes, buildNotesPdfBytes, ACTION_BUTTON_PRESETS, buildSmartArtPresetData, computeSnapToShape, computeMarqueeHitIds, mergeAdditiveSelection, segmentByScript, resolveFontForScript, generateLogTicks, formatAxisValueWithUnits, getDisplayUnitLabel, applyResize, snapBoxToGrid, chartPartToAttrs } from './chunk-I42XL2WU.mjs';
1
+ import { SHAPE_PRESET_DEFS, TOOLBAR_TABS, computeValueRangeForChart, cloneTemplateElementsBySlideId, cloneSlide, countTextSegments, expandTextBuildAnimations, TimelineEngine, TEXT_BUILD_ID_SEP, computeEntranceAnimationDelay, storePresentationDeck, loadPresentationDeck, clearPresentationDeck, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, isPresentationSessionMessage, collectMediaElements, collectImagePaths, buildInitialGuides, saveAutosaveSnapshot, getAnimationInitialStyle, normalizeHexColor, toCssWritingMode, toCssTextOrientation, toCssVerticalDirection, computeAutoFitTextStyle, resolveLineHeight, getKinsokuLineBreakStyles, buildTextBody3DSceneStyle, resolveParagraphRtl, resolveParagraphAlign, resolveCssTextAlign, colorWithOpacity, build3DExtrusionData, getResolvedShapeClipPath, normalizeStrokeDashType, buildCssGradientFromShapeStyle, buildShadowCssFromShapeStyle, buildInnerShadowCssFromShapeStyle, buildMultiLayerShadowCss, buildGlowBoxShadow, getCompoundLineBoxShadow, getEffectDagFilter, buildPatternFillCss, buildReflectionCss, getCssBorderDashStyle, getCompoundLineBorderWidth, getSvgStrokeDasharray, getCompoundLineOffsets, getCompoundLineWidths, clampCropValue, computeSelectionRect, rectToCells, isCellInRect, buildChartViewModel, buildPreviewAnimation, isTemplateElementId, getInlineEditorSelection, applyStyleToSelectedSegments, setPendingSelectionRestore, applyCaseTransformToSegments, transformTextCase, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, normalizeColorsForCapture, preprocessCssForCapture, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, recordProgressPercent, comparePresentation, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, detectTouchDevice, detectOrientation, isMobileViewport, MOBILE_BREAKPOINT, TABLET_BREAKPOINT, remapTextToSegments, shouldLoopContinuously, applyRehearsalTimings, copyFormatFromElement, applyFormatToElement, createSyncGate, validateRoomId, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, BROADCAST_THROTTLE_MS, sanitizeColor, readSlidesFromYDoc, reconcileSlidesInYDoc, LOCAL_SYNC_ORIGIN, observeYDocSlides, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, createTouchGestureRecognizer, isKeyboardOpen, openPptxFile, readBackstageRecentFile, isActionHidden, buildElementClipboardPayload, generatePackageReadme, downloadBlob, groupElements, generateElementId, makeCloneId, alignElements, distributeElements, bringForward, sendBackward, bringToFront, sendToBack, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, derivePresenceList, buildPrintDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, makeSlideId, cloneHistorySnapshot, createPresentationSessionId, resolveTransitionDurationMs, isUrlSafe, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, presenterElapsed, stepPresenterZoom, resetPresenterTimer, togglePresenterTimer, isTemplateElement, substituteFieldText, resolveUnderlineDecorationStyle, hasDistinctScriptFonts, buildTextReflectionCss, getTextAlphaOpacity, buildTextRunFilterChain, buildTextShadowCss, apply3dEffects, clampUnitInterval, getRoundRectRadiusPx, computeColumnBoundaries, parseDrawingColor, parseDrawingColorOpacity, getPatternSvg, ooxmlDashToCssBorderStyle, getChartStylePalette, computeLayout, valueToY, formatAxisValue, computeLayoutOptions, splitSeriesByAxis, computeValueRange, getSecondaryValueAxis, seriesColor, paletteColor, resolveRegionCode, normalizeValue, sequentialColorScale, canvasToJpegData, downloadDataUrl, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, sanitizeDownloadFilename, encodeGif, groupSlidesBySection, hasCopyableFormat, createBackstagePresentation, cloneElementForPaste, computeScrollDelta, rerouteConnectorsForMovedElements, applyReroutedConnectors, buildPrintHtmlDocument, convertOmmlToMathMl, sanitizeMathMl, buildTextFillCss, resolvePictureBullet, computeResizedColumnWidths, computeResizedRowHeight, DEFAULT_ROW_HEIGHT, tintColor2, shadeColor2, deleteTableColumn, insertTableColumn, deleteTableRow, insertTableRow, splitCell, mergeCells, buildSlidesPdfBytes, buildNotesPdfBytes, isPpactionUrl, parsePpactionUrl, safeOpenUrl, ACTION_BUTTON_PRESETS, buildSmartArtPresetData, computeSnapToShape, computeMarqueeHitIds, mergeAdditiveSelection, segmentByScript, resolveFontForScript, generateLogTicks, formatAxisValueWithUnits, getDisplayUnitLabel, applyResize, snapBoxToGrid, chartPartToAttrs } from './chunk-KPT54MHG.mjs';
2
2
  import { translationsEn } from './chunk-E3KJKCSV.mjs';
3
- import { hasTextProperties, PptxHandler, EncryptedFileError, hasShapeProperties, isImageLikeElement, isCalloutShape, getCalloutLeaderLineGeometry, buildCalloutLeaderLineSvgPath, getCalloutViewBoxBounds, applyThemeToData, THEME_PRESETS, themeColorSchemesEqual, guidePxToEmu, mergeShapes, getSubstituteFontFamily, getPresetShapeClipPath, svgPathToPolygons, polygonsToSvgPath, SvgExporter, rebuildTableStructureInRawXml, updateCellTextStyleInRawXml, updateCellTextInRawXml, updateMergeAttrsInRawXml, elementActionToPptxAction } from './chunk-AFWMAFWR.mjs';
3
+ import { hasTextProperties, PptxHandler, EncryptedFileError, hasShapeProperties, isImageLikeElement, isCalloutShape, getCalloutLeaderLineGeometry, buildCalloutLeaderLineSvgPath, getCalloutViewBoxBounds, applyThemeToData, THEME_PRESETS, themeColorSchemesEqual, guidePxToEmu, mergeShapes, getSubstituteFontFamily, getPresetShapeClipPath, svgPathToPolygons, polygonsToSvgPath, SvgExporter, rebuildTableStructureInRawXml, updateCellTextStyleInRawXml, updateCellTextInRawXml, updateMergeAttrsInRawXml, elementActionToPptxAction } from './chunk-LDZQNYWL.mjs';
4
4
  import React3, { useState, useEffect, useMemo, Suspense, useRef, useCallback, useSyncExternalStore, useImperativeHandle, useLayoutEffect } from 'react';
5
5
  import { LuTriangle, LuPlus, LuMoveRight, LuMinus, LuDiamond, LuDatabase, LuCircle, LuSquare } from 'react-icons/lu';
6
6
  import { clsx } from 'clsx';
@@ -8464,7 +8464,7 @@ function FailedToLoad() {
8464
8464
  var LazySurfaceChart3DScene = React3.lazy(
8465
8465
  async () => {
8466
8466
  try {
8467
- return await import('./SurfaceChart3DScene-K7ZDXDBL.mjs');
8467
+ return await import('./SurfaceChart3DScene-VKS3ELTU.mjs');
8468
8468
  } catch {
8469
8469
  return { default: FailedToLoad };
8470
8470
  }
@@ -17019,7 +17019,7 @@ function useYjsDocumentSync({
17019
17019
  return;
17020
17020
  }
17021
17021
  try {
17022
- const { PptxHandler: PptxHandler2 } = await import('./dist-5KQQ6GP2.mjs');
17022
+ const { PptxHandler: PptxHandler2 } = await import('./dist-A3OATMOE.mjs');
17023
17023
  const handler = new PptxHandler2();
17024
17024
  await handler.load(sourceBytes.buffer);
17025
17025
  const currentSlides = readSlidesFromYDoc(
@@ -17396,6 +17396,820 @@ function useKeyboardInsets(enabled = true) {
17396
17396
  }, [enabled]);
17397
17397
  return { keyboardInset, isKeyboardOpen: isKeyboardOpen(keyboardInset) };
17398
17398
  }
17399
+
17400
+ // src/viewer/hooks/useViewerBuildingBlocks-canvas-props.ts
17401
+ function buildCanvasProps(input) {
17402
+ const {
17403
+ mode,
17404
+ canEdit,
17405
+ slides,
17406
+ activeSlide,
17407
+ masterPseudoSlide,
17408
+ templateElements,
17409
+ canvasSize,
17410
+ activeSlideIndex,
17411
+ gridSpacingPx,
17412
+ zoom,
17413
+ state: s,
17414
+ selectedElement,
17415
+ canvasHandlers,
17416
+ insertHandlers,
17417
+ tableOps,
17418
+ presentation,
17419
+ findResults,
17420
+ findResultIndex
17421
+ } = input;
17422
+ const effectiveSlide = mode === "master" ? masterPseudoSlide : activeSlide;
17423
+ const effectiveTemplateElements = mode === "master" ? s.activeLayout ? s.activeMaster?.elements ?? [] : [] : templateElements;
17424
+ let slideTitle;
17425
+ if (activeSlide) {
17426
+ for (const el of activeSlide.elements) {
17427
+ const phType = el.placeholderType;
17428
+ if (phType === "title" || phType === "ctrTitle") {
17429
+ const txt = el.text;
17430
+ if (txt) {
17431
+ slideTitle = txt;
17432
+ break;
17433
+ }
17434
+ }
17435
+ }
17436
+ }
17437
+ const hf = s.headerFooter;
17438
+ const fieldContext = {
17439
+ slideNumber: activeSlide?.slideNumber,
17440
+ dateTimeText: hf.dateTimeText,
17441
+ dateFormat: hf.dateFormat,
17442
+ footerText: hf.footerText,
17443
+ headerText: hf.headerText,
17444
+ slideTitle,
17445
+ customProperties: s.customProperties.map((p) => ({ name: p.name, value: p.value }))
17446
+ };
17447
+ const tableStyleContext = s.theme || s.tableStyleMap ? { theme: s.theme, tableStyleMap: s.tableStyleMap } : void 0;
17448
+ const handleActionClick = (_elementId, action) => {
17449
+ if (mode === "present") {
17450
+ presentation.handlePresentationAction(action);
17451
+ } else if (action.url) {
17452
+ safeOpenUrl(action.url);
17453
+ }
17454
+ };
17455
+ const handleHyperlinkClick = (url) => {
17456
+ if (isPpactionUrl(url)) {
17457
+ if (mode === "present") {
17458
+ const parsed = parsePpactionUrl(url);
17459
+ if (parsed) {
17460
+ presentation.handlePresentationAction({
17461
+ action: parsed.action,
17462
+ targetSlideIndex: parsed.targetSlideIndex
17463
+ });
17464
+ }
17465
+ }
17466
+ return;
17467
+ }
17468
+ safeOpenUrl(url);
17469
+ };
17470
+ return {
17471
+ activeSlide: effectiveSlide,
17472
+ templateElements: effectiveTemplateElements,
17473
+ canvasSize,
17474
+ zoom,
17475
+ mode,
17476
+ canEdit,
17477
+ editTemplateMode: mode === "master" || s.editTemplateMode,
17478
+ selectedElementIdSet: s.selectedElementIdSet,
17479
+ selectedElement,
17480
+ inlineEditingElementId: s.inlineEditingElementId,
17481
+ inlineEditingText: s.inlineEditingText,
17482
+ spellCheckEnabled: s.spellCheckEnabled,
17483
+ mediaDataUrls: s.mediaDataUrls,
17484
+ tableEditorState: s.tableEditorState,
17485
+ marqueeSelectionState: s.marqueeSelectionState,
17486
+ snapLines: s.snapLines,
17487
+ showGrid: s.showGrid,
17488
+ gridSpacingPx,
17489
+ showRulers: s.showRulers,
17490
+ guides: s.guides,
17491
+ presentationElementStates: mode === "present" ? presentation.presentationElementStates : void 0,
17492
+ presentationKeyframesCss: mode === "present" ? presentation.presentationKeyframesCss : void 0,
17493
+ onClick: canvasHandlers.handleElementClick,
17494
+ onDoubleClick: canvasHandlers.handleElementDoubleClick,
17495
+ onMouseDown: canvasHandlers.handleElementMouseDown,
17496
+ onContextMenu: canvasHandlers.handleElementContextMenu,
17497
+ onCanvasMouseDown: canvasHandlers.handleCanvasMouseDown,
17498
+ onResizePointerDown: canvasHandlers.handleResizePointerDown,
17499
+ onAdjustmentPointerDown: canvasHandlers.handleAdjustmentPointerDown,
17500
+ onRotate: canvasHandlers.handleRotate,
17501
+ onInlineEditChange: s.setInlineEditingText,
17502
+ onInlineEditCommit: canvasHandlers.handleInlineEditCommit,
17503
+ onInlineEditCancel: () => s.setInlineEditingElementId(null),
17504
+ onTableCellSelect: (cell, elementId) => s.setTableEditorState(cell ? { ...cell, elementId } : null),
17505
+ onCommitCellEdit: tableOps.handleCommitCellEdit,
17506
+ onUpdateSmartArtElement: canvasHandlers.handleUpdateSmartArtElement,
17507
+ onFormatText: canvasHandlers.handleFormatText,
17508
+ onResizeTableColumns: tableOps.handleResizeTableColumns,
17509
+ onResizeTableRow: tableOps.handleResizeTableRow,
17510
+ findResults,
17511
+ findResultIndex,
17512
+ activeSlideIndex,
17513
+ activeTool: s.activeTool,
17514
+ drawingColor: s.drawingColor,
17515
+ drawingWidth: s.drawingWidth,
17516
+ isDrawingRef: s.isDrawingRef,
17517
+ onAddInkElement: insertHandlers.handleAddInkElement,
17518
+ onAddFreeformShape: insertHandlers.handleAddFreeformShape,
17519
+ onEraseInkElement: insertHandlers.handleEraseInkElement,
17520
+ onActionClick: handleActionClick,
17521
+ onHyperlinkClick: handleHyperlinkClick,
17522
+ allSlides: mode === "present" ? slides : void 0,
17523
+ onZoomClick: mode === "present" ? presentation.handleZoomClick : void 0,
17524
+ sourceSlideIndex: mode === "present" ? activeSlideIndex : void 0,
17525
+ fieldContext,
17526
+ tableStyleContext,
17527
+ // Collaboration cursor/selection overlays require a `CollaborationProvider`
17528
+ // ancestor, which these building blocks intentionally don't render (hosts
17529
+ // that need collaboration should use `PowerPointViewer` directly).
17530
+ collaborationOverlay: void 0,
17531
+ comments: activeSlide?.comments,
17532
+ showCommentMarkers: s.sidebarPanelMode === "comments",
17533
+ onCommentMarkerClick: () => s.setSidebarPanelMode("comments"),
17534
+ onMoveGuide: (guideId, position) => {
17535
+ s.setGuides(
17536
+ (prev) => prev.map(
17537
+ (guide) => guide.id === guideId ? {
17538
+ ...guide,
17539
+ position: guide.axis === "h" ? Math.max(0, Math.min(canvasSize.height, position)) : Math.max(0, Math.min(canvasSize.width, position))
17540
+ } : guide
17541
+ )
17542
+ );
17543
+ },
17544
+ onDeleteGuide: (guideId) => {
17545
+ s.setGuides((prev) => prev.filter((guide) => guide.id !== guideId));
17546
+ },
17547
+ onCreateGuideFromRuler: (axis, positionPx) => {
17548
+ s.setGuides((prev) => [
17549
+ ...prev,
17550
+ {
17551
+ id: `guide-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
17552
+ axis,
17553
+ position: positionPx
17554
+ }
17555
+ ]);
17556
+ }
17557
+ };
17558
+ }
17559
+
17560
+ // src/viewer/hooks/useScopedLayoutOptions.ts
17561
+ function scopeLayoutOptionsToActiveSlide(options, activeSlide) {
17562
+ if (!activeSlide?.layoutPath) {
17563
+ return options;
17564
+ }
17565
+ const hasAnyMasterInfo = options.some((o) => o.masterPath);
17566
+ if (!hasAnyMasterInfo) {
17567
+ return options;
17568
+ }
17569
+ const activeOption = options.find((o) => o.path === activeSlide.layoutPath);
17570
+ const activeMaster = activeOption?.masterPath;
17571
+ if (!activeMaster) {
17572
+ return options;
17573
+ }
17574
+ const scoped = options.filter((o) => o.masterPath === activeMaster);
17575
+ const seen = /* @__PURE__ */ new Map();
17576
+ for (const opt of scoped) {
17577
+ const isActive = opt.path === activeSlide.layoutPath;
17578
+ const existing = seen.get(opt.name);
17579
+ if (!existing || isActive) {
17580
+ seen.set(opt.name, opt);
17581
+ }
17582
+ }
17583
+ const chosen = new Set(Array.from(seen.values()).map((o) => o.path));
17584
+ const result = [];
17585
+ const usedNames = /* @__PURE__ */ new Set();
17586
+ for (const opt of scoped) {
17587
+ if (!chosen.has(opt.path)) {
17588
+ continue;
17589
+ }
17590
+ if (usedNames.has(opt.name)) {
17591
+ continue;
17592
+ }
17593
+ usedNames.add(opt.name);
17594
+ result.push(opt);
17595
+ }
17596
+ return result;
17597
+ }
17598
+
17599
+ // src/viewer/hooks/useViewerBuildingBlocks-toolbar-handlers.ts
17600
+ function buildToolbarAnimationHandlers(input) {
17601
+ const { selectedElement, activeSlide, propertyHandlers, ops, history } = input;
17602
+ const handleAddAnimation = (preset, group) => {
17603
+ if (!selectedElement || !activeSlide) {
17604
+ return;
17605
+ }
17606
+ const current = activeSlide.animations ?? [];
17607
+ const existing = current.find((a) => a.elementId === selectedElement.id);
17608
+ const presetValue = preset;
17609
+ if (existing) {
17610
+ const updated = current.map(
17611
+ (a) => a.elementId === selectedElement.id ? { ...a, [group]: presetValue } : a
17612
+ );
17613
+ propertyHandlers.handleUpdateSlide({ animations: updated });
17614
+ } else {
17615
+ const newAnim = {
17616
+ elementId: selectedElement.id,
17617
+ [group]: presetValue,
17618
+ durationMs: 500,
17619
+ order: current.length,
17620
+ trigger: "onClick"
17621
+ };
17622
+ propertyHandlers.handleUpdateSlide({ animations: [...current, newAnim] });
17623
+ }
17624
+ };
17625
+ const handleRemoveAnimation = () => {
17626
+ if (!selectedElement || !activeSlide) {
17627
+ return;
17628
+ }
17629
+ const current = activeSlide.animations ?? [];
17630
+ const filtered = current.filter((a) => a.elementId !== selectedElement.id);
17631
+ propertyHandlers.handleUpdateSlide({ animations: filtered });
17632
+ };
17633
+ const handleTransitionChange = (updates) => {
17634
+ if (!activeSlide) {
17635
+ return;
17636
+ }
17637
+ const current = activeSlide.transition ?? { type: "none" };
17638
+ propertyHandlers.handleUpdateSlide({ transition: { ...current, ...updates } });
17639
+ };
17640
+ const handleApplyTransitionToAll = () => {
17641
+ const transition = activeSlide?.transition;
17642
+ if (!transition) {
17643
+ return;
17644
+ }
17645
+ ops.updateSlides((prev) => prev.map((sl) => ({ ...sl, transition })));
17646
+ history.markDirty();
17647
+ };
17648
+ return {
17649
+ handleAddAnimation,
17650
+ handleRemoveAnimation,
17651
+ handleTransitionChange,
17652
+ handleApplyTransitionToAll
17653
+ };
17654
+ }
17655
+
17656
+ // src/viewer/hooks/useViewerBuildingBlocks-toolbar-props.ts
17657
+ function buildToolbarProps(input) {
17658
+ const {
17659
+ mode,
17660
+ canEdit,
17661
+ state: s,
17662
+ selectedElement,
17663
+ activeSlide,
17664
+ zoom,
17665
+ history,
17666
+ findReplace,
17667
+ manipulation,
17668
+ insertHandlers,
17669
+ exportHandlers,
17670
+ printHandlers,
17671
+ propertyHandlers,
17672
+ dialogs,
17673
+ slideOps,
17674
+ ops,
17675
+ onSetMode,
17676
+ onEnterPresenterView,
17677
+ onEnterRehearsalMode,
17678
+ onOpenSettings,
17679
+ onOpenHeaderFooter,
17680
+ onOpenShareDialog,
17681
+ onOpenFile,
17682
+ onOpenRecentFile,
17683
+ fileName,
17684
+ hiddenActions
17685
+ } = input;
17686
+ const {
17687
+ handleAddAnimation,
17688
+ handleRemoveAnimation,
17689
+ handleTransitionChange,
17690
+ handleApplyTransitionToAll
17691
+ } = buildToolbarAnimationHandlers({
17692
+ selectedElement,
17693
+ activeSlide,
17694
+ propertyHandlers,
17695
+ ops,
17696
+ history
17697
+ });
17698
+ const scopedLayoutOptions = scopeLayoutOptionsToActiveSlide(s.layoutOptions, activeSlide);
17699
+ return {
17700
+ fileName,
17701
+ mode,
17702
+ canEdit,
17703
+ isNarrowViewport: dialogs.isNarrowViewport,
17704
+ isSidebarCollapsed: !s.isSlidesPaneOpen,
17705
+ isInspectorPaneOpen: s.isInspectorPaneOpen,
17706
+ isCompactToolbarOpen: s.isCompactToolbarOpen,
17707
+ toolbarSection: s.toolbarSection,
17708
+ scale: zoom.scale,
17709
+ canUndo: history.canUndo,
17710
+ canRedo: history.canRedo,
17711
+ undoLabel: history.undoLabel,
17712
+ redoLabel: history.redoLabel,
17713
+ findReplaceOpen: findReplace.findReplaceOpen,
17714
+ selectedElement,
17715
+ tableEditorState: s.tableEditorState,
17716
+ editTemplateMode: s.editTemplateMode,
17717
+ newShapeType: s.newShapeType,
17718
+ activeTool: s.activeTool,
17719
+ drawingColor: s.drawingColor,
17720
+ drawingWidth: s.drawingWidth,
17721
+ clipboardPayload: s.clipboardPayload,
17722
+ onSetMode,
17723
+ onToggleSidebar: () => s.setIsSlidesPaneOpen((p) => !p),
17724
+ onToggleInspector: () => s.setIsInspectorPaneOpen((p) => !p),
17725
+ onOpenAnimationPanel: () => {
17726
+ s.setIsInspectorPaneOpen(true);
17727
+ s.setSidebarPanelMode("properties");
17728
+ },
17729
+ onAddAnimation: handleAddAnimation,
17730
+ onRemoveAnimation: handleRemoveAnimation,
17731
+ onToggleCompactToolbar: () => s.setIsCompactToolbarOpen((p) => !p),
17732
+ onSetToolbarSection: s.setToolbarSection,
17733
+ onZoomIn: zoom.handleZoomIn,
17734
+ onZoomOut: zoom.handleZoomOut,
17735
+ onZoomToFit: zoom.handleZoomToFit,
17736
+ onUndo: history.handleUndo,
17737
+ onRedo: history.handleRedo,
17738
+ onToggleFindReplace: () => findReplace.setFindReplaceOpen(!findReplace.findReplaceOpen),
17739
+ onSetNewShapeType: s.setNewShapeType,
17740
+ onAddTextBox: insertHandlers.handleAddTextBox,
17741
+ onAddShape: insertHandlers.handleAddShape,
17742
+ onAddTable: insertHandlers.handleAddTable,
17743
+ onAddChart: insertHandlers.handleAddChart,
17744
+ onAddSmartArt: () => dialogs.setIsSmartArtDialogOpen(true),
17745
+ onAddEquation: () => {
17746
+ dialogs.setEditingEquationOmml(null);
17747
+ dialogs.setIsEquationDialogOpen(true);
17748
+ },
17749
+ onAddActionButton: insertHandlers.handleAddActionButton,
17750
+ onInsertField: insertHandlers.handleInsertField,
17751
+ onOpenHeaderFooter,
17752
+ onOpenImagePicker: () => s.imageInputRef.current?.click(),
17753
+ onOpenMediaPicker: () => s.mediaInputRef.current?.click(),
17754
+ onSetActiveTool: s.setActiveTool,
17755
+ onSetDrawingColor: s.setDrawingColor,
17756
+ onSetDrawingWidth: s.setDrawingWidth,
17757
+ onSetEditTemplateMode: s.setEditTemplateMode,
17758
+ spellCheckEnabled: s.spellCheckEnabled,
17759
+ showGrid: s.showGrid,
17760
+ showRulers: s.showRulers,
17761
+ snapToGrid: s.snapToGrid,
17762
+ snapToShape: s.snapToShape,
17763
+ onSetSpellCheckEnabled: s.setSpellCheckEnabled,
17764
+ onSetShowGrid: s.setShowGrid,
17765
+ onSetShowRulers: s.setShowRulers,
17766
+ onSetSnapToGrid: s.setSnapToGrid,
17767
+ onSetSnapToShape: s.setSnapToShape,
17768
+ onAddGuide: dialogs.handleAddGuide,
17769
+ onAlignElements: manipulation.handleAlignElements,
17770
+ onDistributeElements: manipulation.handleDistributeElements,
17771
+ canDistribute: manipulation.canDistribute,
17772
+ onCopy: manipulation.handleCopy,
17773
+ onCut: manipulation.handleCut,
17774
+ onPaste: manipulation.handlePaste,
17775
+ onFlip: manipulation.handleFlip,
17776
+ onMoveLayer: manipulation.handleMoveLayer,
17777
+ onMoveLayerToEdge: manipulation.handleMoveLayerToEdge,
17778
+ onDuplicate: manipulation.handleDuplicate,
17779
+ onDelete: manipulation.handleDelete,
17780
+ onExportPng: exportHandlers.handleExportPng,
17781
+ onExportPdf: exportHandlers.handleExportPdf,
17782
+ onExportVideo: exportHandlers.handleExportVideo,
17783
+ onExportGif: exportHandlers.handleExportGif,
17784
+ onPackageForSharing: exportHandlers.handlePackageForSharing,
17785
+ onOpenFile,
17786
+ onOpenRecentFile,
17787
+ onCreatePresentation: (templateId) => {
17788
+ s.setSlides(createBackstagePresentation(templateId));
17789
+ s.setActiveSlideIndex(0);
17790
+ s.setSelectedElementId(null);
17791
+ s.setSelectedElementIds([]);
17792
+ s.setTemplateElementsBySlideId({});
17793
+ s.setIsDirty(true);
17794
+ },
17795
+ onOpenShareDialog,
17796
+ onSaveAsPptx: exportHandlers.handleSaveAsPptx,
17797
+ onSaveAsPpsx: exportHandlers.handleSaveAsPpsx,
17798
+ onSaveAsPptm: exportHandlers.handleSaveAsPptm,
17799
+ hasMacros: s.hasMacros,
17800
+ onCopySlideAsImage: exportHandlers.handleCopySlideAsImage,
17801
+ onPrint: printHandlers.handlePrint,
17802
+ onToggleShortcuts: () => s.setIsShortcutHelpOpen((p) => !p),
17803
+ onOpenSettings,
17804
+ onRunAccessibilityCheck: dialogs.handleRunAccessibilityCheck,
17805
+ onToggleSlideSorter: () => s.setShowSlideSorter((p) => !p),
17806
+ onUpdateTextStyle: ops.updateSelectedTextStyle,
17807
+ onTransformTextCase: ops.updateSelectedTextCase,
17808
+ isOverflowMenuOpen: s.isOverflowMenuOpen,
17809
+ onSetOverflowMenuOpen: s.setIsOverflowMenuOpen,
17810
+ layoutOptions: scopedLayoutOptions,
17811
+ onInsertSlideFromLayout: slideOps.handleInsertSlideFromLayout,
17812
+ customShows: s.customShows,
17813
+ activeCustomShowId: s.activeCustomShowId,
17814
+ onSetActiveCustomShowId: s.setActiveCustomShowId,
17815
+ onCreateCustomShow: dialogs.handleCreateCustomShow,
17816
+ onRenameActiveCustomShow: dialogs.handleRenameActiveCustomShow,
17817
+ onDeleteActiveCustomShow: dialogs.handleDeleteActiveCustomShow,
17818
+ onToggleCurrentSlideInActiveShow: dialogs.handleToggleCurrentSlideInActiveShow,
17819
+ isCurrentSlideInActiveShow: dialogs.isCurrentSlideInActiveShow,
17820
+ onEnterMasterView: dialogs.handleEnterMasterView,
17821
+ onCloseMasterView: dialogs.handleCloseMasterView,
17822
+ onToggleVersionHistory: () => propertyHandlers.setIsVersionHistoryOpen((p) => !p),
17823
+ onOpenPasswordProtection: () => dialogs.setIsPasswordDialogOpen(true),
17824
+ onOpenDocumentProperties: () => dialogs.setIsDocPropsDialogOpen(true),
17825
+ onOpenFontEmbedding: () => dialogs.setIsFontEmbeddingOpen(true),
17826
+ onOpenDigitalSignatures: () => dialogs.setIsDigitalSigDialogOpen(true),
17827
+ onEnterPresenterView,
17828
+ onEnterRehearsalMode,
17829
+ onToggleThemeEditor: () => s.setIsThemeEditorOpen((p) => !p),
17830
+ isThemeEditorOpen: s.isThemeEditorOpen,
17831
+ onToggleThemeGallery: () => s.setIsThemeGalleryOpen((p) => !p),
17832
+ isThemeGalleryOpen: s.isThemeGalleryOpen,
17833
+ onCompare: propertyHandlers.handleCompare,
17834
+ onToggleComments: () => {
17835
+ s.setSidebarPanelMode("comments");
17836
+ if (!s.isInspectorPaneOpen) {
17837
+ s.setIsInspectorPaneOpen(true);
17838
+ }
17839
+ },
17840
+ isCommentsPanelOpen: s.isInspectorPaneOpen,
17841
+ slideCommentCount: activeSlide?.comments?.length ?? 0,
17842
+ formatPainterActive: s.formatPainterActive,
17843
+ canActivateFormatPainter: hasCopyableFormat(selectedElement),
17844
+ onToggleFormatPainter: () => s.setFormatPainterActive((p) => !p),
17845
+ isSelectionPaneOpen: s.isSelectionPaneOpen,
17846
+ onToggleSelectionPane: () => s.setIsSelectionPaneOpen((p) => !p),
17847
+ eyedropperActive: s.eyedropperActive,
17848
+ onToggleEyedropper: () => s.setEyedropperActive((p) => !p),
17849
+ onOpenSetUpSlideShow: () => dialogs.setIsSetUpSlideShowOpen(true),
17850
+ onOpenBroadcastDialog: () => dialogs.setIsBroadcastDialogOpen(true),
17851
+ onToggleSubtitles: dialogs.handleToggleSubtitles,
17852
+ showSubtitles: Boolean(s.presentationProperties.showSubtitles),
17853
+ activeSlide,
17854
+ onTransitionChange: handleTransitionChange,
17855
+ onApplyTransitionToAll: handleApplyTransitionToAll,
17856
+ hiddenActions
17857
+ };
17858
+ }
17859
+ function useViewerBuildingBlocksCore(input) {
17860
+ const { content} = input;
17861
+ const state = useViewerState();
17862
+ const {
17863
+ containerRef,
17864
+ mode,
17865
+ slides,
17866
+ canvasSize,
17867
+ loading,
17868
+ error,
17869
+ activeSlideIndex,
17870
+ selectedElementId,
17871
+ selectedElementIds,
17872
+ templateElementsBySlideId,
17873
+ activeSlide,
17874
+ selectedElement
17875
+ } = state;
17876
+ const hasActivePointerInteraction = useCallback(
17877
+ () => Boolean(
17878
+ state.dragStateRef.current || state.resizeStateRef.current || state.marqueeStateRef.current || state.shapeAdjustmentDragStateRef.current || state.isDrawingRef.current
17879
+ ),
17880
+ [
17881
+ state.dragStateRef,
17882
+ state.resizeStateRef,
17883
+ state.marqueeStateRef,
17884
+ state.shapeAdjustmentDragStateRef,
17885
+ state.isDrawingRef
17886
+ ]
17887
+ );
17888
+ const zoom = useZoomViewport({ canvasSize, selectedElements: state.selectedElements });
17889
+ const history = useEditorHistory({
17890
+ slides,
17891
+ canvasSize,
17892
+ activeSlideIndex,
17893
+ templateElementsBySlideId,
17894
+ editTemplateMode: state.editTemplateMode,
17895
+ headerFooter: state.headerFooter,
17896
+ loading,
17897
+ error,
17898
+ hasActivePointerInteraction,
17899
+ pointerCommitNonce: state.pointerCommitNonce,
17900
+ setSlides: state.setSlides,
17901
+ setCanvasSize: state.setCanvasSize,
17902
+ setActiveSlideIndex: state.setActiveSlideIndex,
17903
+ setTemplateElementsBySlideId: state.setTemplateElementsBySlideId,
17904
+ setSelectedElementId: state.setSelectedElementId,
17905
+ setSelectedElementIds: state.setSelectedElementIds,
17906
+ setEditTemplateMode: state.setEditTemplateMode,
17907
+ setHeaderFooter: state.setHeaderFooter
17908
+ });
17909
+ const { gridSpacingPx, visibleSlideIndexes, masterPseudoSlide } = useDerivedSlideState({
17910
+ slides,
17911
+ sections: state.sections,
17912
+ customShows: state.customShows,
17913
+ activeCustomShowId: state.activeCustomShowId,
17914
+ mode,
17915
+ activeLayout: state.activeLayout,
17916
+ activeMaster: state.activeMaster,
17917
+ presentationGridSpacing: state.presentationProperties.gridSpacing
17918
+ });
17919
+ const { presentation, annotations, actionSoundHandlerRef } = usePresentationSetup({
17920
+ mode,
17921
+ slides,
17922
+ visibleSlideIndexes,
17923
+ activeSlideIndex,
17924
+ containerRef,
17925
+ content,
17926
+ mediaDataUrls: state.mediaDataUrls,
17927
+ presentationProperties: state.presentationProperties,
17928
+ setMode: state.setMode,
17929
+ setActiveSlideIndex: state.setActiveSlideIndex,
17930
+ setSlides: state.setSlides,
17931
+ history
17932
+ });
17933
+ return {
17934
+ state,
17935
+ mode,
17936
+ slides,
17937
+ loading,
17938
+ error,
17939
+ activeSlideIndex,
17940
+ activeSlide,
17941
+ selectedElement,
17942
+ zoom,
17943
+ history,
17944
+ presentation,
17945
+ annotations,
17946
+ actionSoundHandlerRef,
17947
+ masterPseudoSlide,
17948
+ gridSpacingPx
17949
+ };
17950
+ }
17951
+ function useViewerBuildingBlocksState(input) {
17952
+ const { core, content, canEdit, filePath, autosaveEnabled, userName, handle, setContent } = input;
17953
+ const {
17954
+ onContentChange,
17955
+ onDirtyChange,
17956
+ onActiveSlideChange,
17957
+ onModeChange,
17958
+ onZoomChange,
17959
+ onSelectionChange,
17960
+ onSlideCountChange
17961
+ } = input;
17962
+ const {
17963
+ state,
17964
+ mode,
17965
+ slides,
17966
+ loading,
17967
+ error,
17968
+ activeSlideIndex,
17969
+ activeSlide,
17970
+ selectedElement,
17971
+ zoom,
17972
+ history,
17973
+ presentation,
17974
+ annotations,
17975
+ actionSoundHandlerRef,
17976
+ gridSpacingPx
17977
+ } = core;
17978
+ const dialogs = useViewerDialogs({
17979
+ mode,
17980
+ slides,
17981
+ activeSlide,
17982
+ canvasSize: state.canvasSize,
17983
+ containerRef: state.containerRef,
17984
+ customShows: state.customShows,
17985
+ activeCustomShowId: state.activeCustomShowId,
17986
+ setCustomShows: state.setCustomShows,
17987
+ setActiveCustomShowId: state.setActiveCustomShowId,
17988
+ setGuides: state.setGuides,
17989
+ setPresentationProperties: state.setPresentationProperties,
17990
+ setAccessibilityIssues: state.setAccessibilityIssues,
17991
+ setIsAccessibilityPanelOpen: state.setIsAccessibilityPanelOpen,
17992
+ setMode: state.setMode,
17993
+ setPreMasterMode: state.setPreMasterMode,
17994
+ setActiveMasterIndex: state.setActiveMasterIndex,
17995
+ setActiveLayoutIndex: state.setActiveLayoutIndex,
17996
+ setSelectedElementId: state.setSelectedElementId,
17997
+ setSelectedElementIds: state.setSelectedElementIds,
17998
+ preMasterMode: state.preMasterMode,
17999
+ hasDigitalSignatures: state.hasDigitalSignatures,
18000
+ isDirty: state.isDirty,
18001
+ history
18002
+ });
18003
+ useEffect(() => {
18004
+ state.setSelectedElementId(null);
18005
+ state.setSelectedElementIds([]);
18006
+ state.setInlineEditingElementId(null);
18007
+ }, [activeSlideIndex]);
18008
+ const editorOps = useEditorOperations({
18009
+ state,
18010
+ history,
18011
+ zoom,
18012
+ mode,
18013
+ canEdit,
18014
+ slides,
18015
+ activeSlide,
18016
+ activeSlideIndex,
18017
+ selectedElement,
18018
+ selectedElementId: state.selectedElementId,
18019
+ selectedElementIds: state.selectedElementIds,
18020
+ canvasSize: state.canvasSize,
18021
+ dialogs,
18022
+ presentation,
18023
+ userName,
18024
+ handlerRef: actionSoundHandlerRef
18025
+ });
18026
+ const {
18027
+ exportHandlers,
18028
+ printHandlers,
18029
+ propertyHandlers,
18030
+ handleSetMode,
18031
+ handleEnterPresenterView,
18032
+ handleEnterRehearsalMode,
18033
+ autosaveStatus
18034
+ } = useViewerIntegration({
18035
+ state,
18036
+ zoom,
18037
+ history,
18038
+ presentation,
18039
+ annotations,
18040
+ actionSoundHandlerRef,
18041
+ editorOps,
18042
+ dialogs,
18043
+ gridSpacingPx,
18044
+ content,
18045
+ filePath,
18046
+ autosaveEnabled,
18047
+ canEdit,
18048
+ mode,
18049
+ slides,
18050
+ activeSlide,
18051
+ activeSlideIndex,
18052
+ canvasSize: state.canvasSize,
18053
+ loading,
18054
+ error,
18055
+ ref: handle ?? null,
18056
+ setContent,
18057
+ onContentChange,
18058
+ onDirtyChange,
18059
+ onActiveSlideChange,
18060
+ onModeChange,
18061
+ onZoomChange,
18062
+ onSelectionChange,
18063
+ onSlideCountChange
18064
+ });
18065
+ return {
18066
+ dialogs,
18067
+ editorOps,
18068
+ exportHandlers,
18069
+ printHandlers,
18070
+ propertyHandlers,
18071
+ handleSetMode,
18072
+ handleEnterPresenterView,
18073
+ handleEnterRehearsalMode,
18074
+ autosaveStatus
18075
+ };
18076
+ }
18077
+
18078
+ // src/viewer/hooks/useViewerBuildingBlocks.ts
18079
+ function useViewerBuildingBlocks(input) {
18080
+ const {
18081
+ content: incomingContent,
18082
+ canEdit = false,
18083
+ filePath,
18084
+ fileName,
18085
+ autosaveEnabled = true,
18086
+ userName,
18087
+ hiddenActions,
18088
+ handle,
18089
+ onContentChange,
18090
+ onDirtyChange,
18091
+ onActiveSlideChange,
18092
+ onModeChange,
18093
+ onZoomChange,
18094
+ onSelectionChange,
18095
+ onSlideCountChange,
18096
+ onOpenSettings,
18097
+ onOpenHeaderFooter,
18098
+ onOpenShareDialog
18099
+ } = input;
18100
+ const [content, setContent] = useState(incomingContent ?? null);
18101
+ useEffect(() => {
18102
+ setContent(incomingContent ?? null);
18103
+ }, [incomingContent]);
18104
+ const onOpenFile = useCallback(() => {
18105
+ void (async () => {
18106
+ const picked = await openPptxFile();
18107
+ if (picked) {
18108
+ setContent(picked.buffer);
18109
+ }
18110
+ })();
18111
+ }, []);
18112
+ const onOpenRecentFile = useCallback((key) => {
18113
+ void (async () => {
18114
+ const bytes = await readBackstageRecentFile(key);
18115
+ if (bytes) {
18116
+ setContent(bytes);
18117
+ }
18118
+ })();
18119
+ }, []);
18120
+ const core = useViewerBuildingBlocksCore({ content});
18121
+ const {
18122
+ state,
18123
+ mode,
18124
+ slides,
18125
+ loading,
18126
+ error,
18127
+ activeSlideIndex,
18128
+ activeSlide,
18129
+ selectedElement,
18130
+ zoom,
18131
+ history,
18132
+ presentation,
18133
+ masterPseudoSlide,
18134
+ gridSpacingPx
18135
+ } = core;
18136
+ const {
18137
+ dialogs,
18138
+ editorOps,
18139
+ exportHandlers,
18140
+ printHandlers,
18141
+ propertyHandlers,
18142
+ handleSetMode,
18143
+ handleEnterPresenterView,
18144
+ handleEnterRehearsalMode,
18145
+ autosaveStatus
18146
+ } = useViewerBuildingBlocksState({
18147
+ core,
18148
+ content,
18149
+ canEdit,
18150
+ filePath,
18151
+ autosaveEnabled,
18152
+ userName,
18153
+ handle,
18154
+ setContent,
18155
+ onContentChange,
18156
+ onDirtyChange,
18157
+ onActiveSlideChange,
18158
+ onModeChange,
18159
+ onZoomChange,
18160
+ onSelectionChange,
18161
+ onSlideCountChange
18162
+ });
18163
+ const toolbarProps = buildToolbarProps({
18164
+ mode,
18165
+ canEdit,
18166
+ state,
18167
+ selectedElement,
18168
+ activeSlide,
18169
+ zoom,
18170
+ history,
18171
+ findReplace: editorOps.findReplace,
18172
+ manipulation: editorOps.manipulation,
18173
+ insertHandlers: editorOps.insertHandlers,
18174
+ exportHandlers,
18175
+ printHandlers,
18176
+ propertyHandlers,
18177
+ dialogs,
18178
+ slideOps: editorOps.slideOps,
18179
+ ops: editorOps.ops,
18180
+ onSetMode: handleSetMode,
18181
+ onEnterPresenterView: handleEnterPresenterView,
18182
+ onEnterRehearsalMode: handleEnterRehearsalMode,
18183
+ onOpenSettings,
18184
+ onOpenHeaderFooter,
18185
+ onOpenShareDialog,
18186
+ onOpenFile,
18187
+ onOpenRecentFile,
18188
+ fileName,
18189
+ hiddenActions
18190
+ });
18191
+ const canvasProps = buildCanvasProps({
18192
+ mode,
18193
+ canEdit,
18194
+ slides,
18195
+ activeSlide,
18196
+ masterPseudoSlide,
18197
+ templateElements: state.templateElements,
18198
+ canvasSize: state.canvasSize,
18199
+ activeSlideIndex,
18200
+ gridSpacingPx,
18201
+ zoom,
18202
+ state,
18203
+ selectedElement,
18204
+ canvasHandlers: editorOps.canvasHandlers,
18205
+ insertHandlers: editorOps.insertHandlers,
18206
+ tableOps: editorOps.tableOps,
18207
+ presentation,
18208
+ findResults: editorOps.findReplace.findResults,
18209
+ findResultIndex: editorOps.findReplace.findResultIndex
18210
+ });
18211
+ return { toolbarProps, canvasProps, mode, loading, error, autosaveStatus };
18212
+ }
17399
18213
  var LEFT_MIN = 120;
17400
18214
  var LEFT_MAX = 400;
17401
18215
  var LEFT_DEFAULT = 180;
@@ -17466,4 +18280,4 @@ function useSwipeNavigation(input) {
17466
18280
  return { onTouchStart, onTouchEnd };
17467
18281
  }
17468
18282
 
17469
- export { ACTION_VERB_MAP, ANIMATION_PRESET_OPTIONS, DEFAULT_FILL_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_FONT_SIZE, GRID_SIZE, HYPERLINK_COLOR, MIN_ELEMENT_SIZE, MIN_TOUCH_TARGET, SHAPE_PRESETS, SHORTCUT_REFERENCE_ITEMS, SLIDE_NAV_THUMBNAIL_WIDTH, SLIDE_TRANSITION_OPTIONS, SmartArtNodeText, TOOLBAR_SECTIONS, build3DExtrusionData2 as build3DExtrusionData, buildLineGlowFilter, buildLineShadowCss, buildReactChartViewModel, buildTextBody3DSceneStyle2 as buildTextBody3DSceneStyle, buildTree, chevronPoints, clearAudienceContent, cn, colour, computeToolbarVisibility, detectTargetType, fitFontSize, gearPath, getAnimationInitialStyle2 as getAnimationInitialStyle, getConnectorPathGeometry, getCropShapeClipPath, getDuotoneColors, getImageRenderStyle, getImageTilingStyle, getShapeVisualStyle, getTextLayoutStyle, getTextStyleForElement, getTextWarpStyle, hasDagDuotoneEffect, isAudienceTab, isConnectorOrLineElement, isImageTiled, layoutToCategory, loadAudienceContent, nodeOpacity, parseAudienceNonce, parseEmailUrl, parseSlideFromUrl, renderAccentProcess, renderAlternatingFlow, renderChartElement, renderConnectorMarker, renderDagDuotoneSvgFilter, renderDescendingProcess, renderGroupedList, renderHorizontalPictureList, renderMediaElement, renderPictureAccentList, renderPyramidList, renderStepDownProcess, renderTableElement, renderTextSegments, renderToCanvas, renderVectorShape, renderVerticalBlockList, renderVerticalChevronList, resolvePalette, resolveSmartArtDataPalette, resolveStyle, shouldRenderFallbackLabel, smartArtNodeGroupProps, startPreviewAnimation, stopPreviewAnimation, storeAudienceContent, styleShadow, styleStroke, treeDepth, treeWidth, truncate, useAnimationPlayback, useAnnotationHandlers, useAudienceMode, useAutosave, useBroadcastFollower, useCanvasInteractions, useClipboardHandlers, useCollaborativeHistory, useCollaborativeState, useComments, useContentLifecycle, useDerivedElementState, useDerivedSlideState, useDialogCustomShows, useEditorHistory, useEditorOperations, useElementManipulation, useElementOperations, useExportHandlers, useExportSaveAs, useFindReplace, useFollowMode, useFontInjection, useGroupAlignLayerHandlers, useIOHandlers, useInsertElements, useIsMobile, useKeyboardInsets, useKeyboardShortcutWiring, useKeyboardShortcuts, useLayoutSwitching, useLoadContent, useMergeShapesHandler, useModalDismissDrag, usePointerHandlers, usePresenceTracking, usePresentationAnnotations, usePresentationKeyboard, usePresentationMode, usePresentationSetup, usePresenterWindow, usePrintHandlers, usePropertyHandlers, useRecoveryDetection, useReducedMotion, useRehearsalTimings, useResizablePanels, useSectionOperations, useSerialize, useSheetDismissDrag, useSlideManagement, useSlideNavigation, useSwipeNavigation, useTableOperations, useThemeHandlers, useThemeSwitching, useToolbarVisibility, useTouchGestures, useViewerCoreState, useViewerDialogs, useViewerIntegration, useViewerState, useViewerUIState, useVirtualizedSlides, useYjsDocumentSync, useYjsProvider, useZoomNavigation, useZoomViewport, wrapChrome };
18283
+ export { ACTION_VERB_MAP, ANIMATION_PRESET_OPTIONS, DEFAULT_FILL_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_FONT_SIZE, GRID_SIZE, HYPERLINK_COLOR, MIN_ELEMENT_SIZE, MIN_TOUCH_TARGET, SHAPE_PRESETS, SHORTCUT_REFERENCE_ITEMS, SLIDE_NAV_THUMBNAIL_WIDTH, SLIDE_TRANSITION_OPTIONS, SmartArtNodeText, TOOLBAR_SECTIONS, build3DExtrusionData2 as build3DExtrusionData, buildLineGlowFilter, buildLineShadowCss, buildReactChartViewModel, buildTextBody3DSceneStyle2 as buildTextBody3DSceneStyle, buildTree, chevronPoints, clearAudienceContent, cn, colour, computeToolbarVisibility, detectTargetType, fitFontSize, gearPath, getAnimationInitialStyle2 as getAnimationInitialStyle, getConnectorPathGeometry, getCropShapeClipPath, getDuotoneColors, getImageRenderStyle, getImageTilingStyle, getShapeVisualStyle, getTextLayoutStyle, getTextStyleForElement, getTextWarpStyle, hasDagDuotoneEffect, isAudienceTab, isConnectorOrLineElement, isImageTiled, layoutToCategory, loadAudienceContent, nodeOpacity, parseAudienceNonce, parseEmailUrl, parseSlideFromUrl, renderAccentProcess, renderAlternatingFlow, renderChartElement, renderConnectorMarker, renderDagDuotoneSvgFilter, renderDescendingProcess, renderGroupedList, renderHorizontalPictureList, renderMediaElement, renderPictureAccentList, renderPyramidList, renderStepDownProcess, renderTableElement, renderTextSegments, renderToCanvas, renderVectorShape, renderVerticalBlockList, renderVerticalChevronList, resolvePalette, resolveSmartArtDataPalette, resolveStyle, scopeLayoutOptionsToActiveSlide, shouldRenderFallbackLabel, smartArtNodeGroupProps, startPreviewAnimation, stopPreviewAnimation, storeAudienceContent, styleShadow, styleStroke, treeDepth, treeWidth, truncate, useAnimationPlayback, useAnnotationHandlers, useAudienceMode, useAutosave, useBroadcastFollower, useCanvasInteractions, useClipboardHandlers, useCollaborativeHistory, useCollaborativeState, useComments, useContentLifecycle, useDerivedElementState, useDerivedSlideState, useDialogCustomShows, useEditorHistory, useEditorOperations, useElementManipulation, useElementOperations, useExportHandlers, useExportSaveAs, useFindReplace, useFollowMode, useFontInjection, useGroupAlignLayerHandlers, useIOHandlers, useInsertElements, useIsMobile, useKeyboardInsets, useKeyboardShortcutWiring, useKeyboardShortcuts, useLayoutSwitching, useLoadContent, useMergeShapesHandler, useModalDismissDrag, usePointerHandlers, usePresenceTracking, usePresentationAnnotations, usePresentationKeyboard, usePresentationMode, usePresentationSetup, usePresenterWindow, usePrintHandlers, usePropertyHandlers, useRecoveryDetection, useReducedMotion, useRehearsalTimings, useResizablePanels, useSectionOperations, useSerialize, useSheetDismissDrag, useSlideManagement, useSlideNavigation, useSwipeNavigation, useTableOperations, useThemeHandlers, useThemeSwitching, useToolbarVisibility, useTouchGestures, useViewerBuildingBlocks, useViewerCoreState, useViewerDialogs, useViewerIntegration, useViewerState, useViewerUIState, useVirtualizedSlides, useYjsDocumentSync, useYjsProvider, useZoomNavigation, useZoomViewport, wrapChrome };