pptx-react-viewer 4.44.0 → 4.45.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 (43) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{chunk-OYK6O2UM.js → chunk-2YCROYR6.js} +73 -4
  3. package/dist/chunk-2YCROYR6.js.br +0 -0
  4. package/dist/chunk-2YCROYR6.js.gz +0 -0
  5. package/dist/{chunk-NXOETWSO.mjs → chunk-66APV3YZ.mjs} +74 -5
  6. package/dist/chunk-66APV3YZ.mjs.br +0 -0
  7. package/dist/chunk-66APV3YZ.mjs.gz +0 -0
  8. package/dist/{chunk-YIYIJB3X.js → chunk-KUQRWMIK.js} +152 -117
  9. package/dist/chunk-KUQRWMIK.js.br +0 -0
  10. package/dist/chunk-KUQRWMIK.js.gz +0 -0
  11. package/dist/{chunk-W6PDVBAF.mjs → chunk-VUE3EPTJ.mjs} +38 -3
  12. package/dist/chunk-VUE3EPTJ.mjs.br +0 -0
  13. package/dist/chunk-VUE3EPTJ.mjs.gz +0 -0
  14. package/dist/index.d.ts +18 -0
  15. package/dist/index.js +22 -22
  16. package/dist/index.js.br +0 -0
  17. package/dist/index.js.gz +0 -0
  18. package/dist/index.mjs +2 -2
  19. package/dist/index.mjs.br +0 -0
  20. package/dist/index.mjs.gz +0 -0
  21. package/dist/internals.d.ts +10 -1
  22. package/dist/internals.js +80 -80
  23. package/dist/internals.js.br +0 -0
  24. package/dist/internals.js.gz +0 -0
  25. package/dist/internals.mjs +1 -1
  26. package/dist/internals.mjs.br +0 -0
  27. package/dist/internals.mjs.gz +0 -0
  28. package/dist/viewer/index.d.ts +12 -1
  29. package/dist/viewer/index.js +17 -17
  30. package/dist/viewer/index.js.br +0 -0
  31. package/dist/viewer/index.js.gz +0 -0
  32. package/dist/viewer/index.mjs +2 -2
  33. package/dist/viewer/index.mjs.br +0 -0
  34. package/dist/viewer/index.mjs.gz +0 -0
  35. package/package.json +3 -3
  36. package/dist/chunk-NXOETWSO.mjs.br +0 -0
  37. package/dist/chunk-NXOETWSO.mjs.gz +0 -0
  38. package/dist/chunk-OYK6O2UM.js.br +0 -0
  39. package/dist/chunk-OYK6O2UM.js.gz +0 -0
  40. package/dist/chunk-W6PDVBAF.mjs.br +0 -0
  41. package/dist/chunk-W6PDVBAF.mjs.gz +0 -0
  42. package/dist/chunk-YIYIJB3X.js.br +0 -0
  43. package/dist/chunk-YIYIJB3X.js.gz +0 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ A release listed with no entries carried no Conventional Commit in this package'
7
7
  scope: scripts/release-plan.mjs releases whenever any published file changes, not only on
8
8
  conventional commits.
9
9
 
10
+ ## [4.45.0](https://github.com/ChristopherVR/ooxml/releases/tag/pptx-react-viewer@4.45.0) - 2026-10-22
11
+
12
+ ### Features
13
+
14
+ - **automation:** Define word, excel and visio tools once in core ([bed1839](https://github.com/ChristopherVR/ooxml/commit/bed18392fec1f07fa9a0c1eabf8a7c1bb25b0387))
15
+ - **pptx:** Report the shared collaboration state from every binding ([62752ef](https://github.com/ChristopherVR/ooxml/commit/62752efd7b2f9df8372db485cd23c2a6ed5f15ee))
16
+ - **react:** Open useViewerBuildingBlocks on an initial slide ([#158](https://github.com/ChristopherVR/ooxml/issues/158)) ([b750d32](https://github.com/ChristopherVR/ooxml/commit/b750d321ecd556c5c0813eec29c45506227c0597))
17
+ - **automation:** Propose xlsx edits as a reviewable diff ([0e13837](https://github.com/ChristopherVR/ooxml/commit/0e13837c6fdf0766e21aa8a31ef69737df8ab203))
18
+ - **automation:** Add xlsx_propose_edits and xlsx_apply_proposal tools ([8c7500d](https://github.com/ChristopherVR/ooxml/commit/8c7500df317f1cffa3016705369e52b0a5ad0218))
19
+ - **pptx:** Define the powerpoint tools as shared automation tools ([88acafd](https://github.com/ChristopherVR/ooxml/commit/88acafd82419de2cefbebd4b91b935c378f8c772))
20
+ - **pptx:** Connect through a provider, webrtc or same-browser room ([4ae5288](https://github.com/ChristopherVR/ooxml/commit/4ae528882a33ec93730f30bf642589a00b6edf06))
21
+
22
+ ### Bug Fixes
23
+
24
+ - **pptx:** Render flowChart connector presets as shapes, not lines ([978593a](https://github.com/ChristopherVR/ooxml/commit/978593a0d0067d97105fd98b8d640dc929ec9f2b))
25
+ - **pptx:** Paint picture fills inherited from layout placeholders ([71b8196](https://github.com/ChristopherVR/ooxml/commit/71b81964ca4b19ef9cc143fa970479614426bd9d))
26
+
10
27
  ## [4.44.0](https://github.com/ChristopherVR/ooxml/releases/tag/pptx-react-viewer@4.44.0) - 2026-10-21
11
28
 
12
29
  ### Features
@@ -497,15 +497,70 @@ function useCollaborationSession({ config }) {
497
497
  const external = useExternalYjsSession(config?.externalSession);
498
498
  return config?.externalSession ? external : owned;
499
499
  }
500
+ function useOwnedCollaboration(config) {
501
+ const needs = Boolean(config && pptx.needsOwnedSession(config));
502
+ const [opened, setOpened] = React17.useState(null);
503
+ React17.useEffect(() => {
504
+ if (!config || !pptx.needsOwnedSession(config)) {
505
+ return;
506
+ }
507
+ const owned = pptx.openOwnedCollaboration(config);
508
+ let live = true;
509
+ owned.ready.then(
510
+ (prepared) => {
511
+ if (live && prepared) {
512
+ setOpened({ source: config, prepared });
513
+ }
514
+ },
515
+ () => {
516
+ if (live) {
517
+ setOpened({ failed: true });
518
+ }
519
+ }
520
+ );
521
+ return () => {
522
+ live = false;
523
+ owned.release();
524
+ setOpened(null);
525
+ };
526
+ }, [
527
+ needs,
528
+ config?.roomId,
529
+ config?.provider,
530
+ config?.serverUrl,
531
+ config?.transport,
532
+ config?.role,
533
+ config?.userName,
534
+ config?.userColor,
535
+ config?.userAvatar
536
+ ]);
537
+ return React17.useMemo(() => {
538
+ if (!needs) {
539
+ return { config, holding: false, status: void 0 };
540
+ }
541
+ if (opened && "prepared" in opened) {
542
+ return {
543
+ config: { ...config, externalSession: opened.prepared.externalSession },
544
+ holding: false,
545
+ status: void 0
546
+ };
547
+ }
548
+ return { config, holding: true, status: opened ? "error" : "connecting" };
549
+ }, [needs, config, opened]);
550
+ }
500
551
 
501
552
  // src/viewer/hooks/collaboration/useCollaborativeState.ts
502
553
  function useCollaborativeState({
503
- config,
554
+ config: requested,
504
555
  canvasWidth,
505
556
  canvasHeight
506
557
  }) {
558
+ const ownedSession = useOwnedCollaboration(requested);
559
+ const config = ownedSession.config;
507
560
  const userColor = pptx.sanitizeColor(config?.userColor, "#6366f1");
508
- const { status, awareness, doc, clientId, synced, retry } = useCollaborationSession({ config });
561
+ const session = useCollaborationSession({ config: ownedSession.holding ? void 0 : config });
562
+ const { awareness, doc, clientId, synced, retry } = session;
563
+ const status = ownedSession.status ?? session.status;
509
564
  const { remoteUsers, broadcastPresence } = usePresenceTracking({
510
565
  awareness,
511
566
  localClientId: clientId,
@@ -518,8 +573,18 @@ function useCollaborativeState({
518
573
  });
519
574
  const connectedCount = status === "connected" ? remoteUsers.length + 1 : remoteUsers.length;
520
575
  return React17.useMemo(
521
- () => config ? { status, remoteUsers, broadcastPresence, connectedCount, config, doc, synced, retry } : null,
522
- [status, remoteUsers, broadcastPresence, connectedCount, config, doc, synced, retry]
576
+ () => config ? {
577
+ status,
578
+ remoteUsers,
579
+ broadcastPresence,
580
+ connectedCount,
581
+ config,
582
+ doc,
583
+ synced,
584
+ retry,
585
+ clientId
586
+ } : null,
587
+ [status, remoteUsers, broadcastPresence, connectedCount, config, doc, synced, retry, clientId]
523
588
  );
524
589
  }
525
590
  var CollaborationContext = React17.createContext(null);
@@ -13151,6 +13216,7 @@ function useViewPreferencesSync(input) {
13151
13216
  // src/viewer/hooks/useViewerBuildingBlocksState.ts
13152
13217
  function useViewerBuildingBlocksState(input) {
13153
13218
  const { core, content, canEdit, filePath, autosaveEnabled, userName, handle, setContent } = input;
13219
+ const { initialSlide } = input;
13154
13220
  const {
13155
13221
  onContentChange,
13156
13222
  onDirtyChange,
@@ -13253,6 +13319,7 @@ function useViewerBuildingBlocksState(input) {
13253
13319
  content,
13254
13320
  filePath,
13255
13321
  autosaveEnabled,
13322
+ initialSlide,
13256
13323
  // Trust Center > "Allow external content": same gate `PowerPointViewer`
13257
13324
  // applies, so the headless building-blocks API loads http(s) images
13258
13325
  // under the same default-off, core-side SSRF/privacy guard.
@@ -13316,6 +13383,7 @@ function useViewerBuildingBlocks(input) {
13316
13383
  canEdit: requestedCanEdit = false,
13317
13384
  filePath,
13318
13385
  fileName,
13386
+ initialSlide,
13319
13387
  autosaveEnabled = true,
13320
13388
  userName,
13321
13389
  hiddenActions,
@@ -13403,6 +13471,7 @@ function useViewerBuildingBlocks(input) {
13403
13471
  content,
13404
13472
  canEdit,
13405
13473
  filePath,
13474
+ initialSlide,
13406
13475
  autosaveEnabled,
13407
13476
  userName,
13408
13477
  handle,
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  import { dist_exports, normalizeHexColor, DEFAULT_STROKE_COLOR, colorWithOpacity, normalizeStrokeDashType, getSvgStrokeDasharray, getCompoundLineOffsets, getCompoundLineWidths, getConnectorPathGeometry, buildLineShadowCss, buildLineGlowFilter, renderConnectorMarker, getAriaRoleDescription, getAriaLabel, getAriaRole, isEditableTextElement, getShapeVisualStyle, getTextStyleForElement, DEFAULT_TEXT_COLOR, renderVectorShape, isConnectorOrLineElement, build3DExtrusionData, getImageEffectsOpacity, getImageEffectsFilter, getImageRenderStyle, cn, ACTION_BUTTON_PRESETS, getImageSurfaceStyle, getTextLayoutStyle, renderTableElement, renderMediaElement, shouldRenderFallbackLabel, getElementLabel, DEFAULT_FILL_COLOR, buildCssGradientFromShapeStyle, getCropShapeClipPath, getElementTransform, hasDagDuotoneEffect, renderDagDuotoneSvgFilter, getImageSurfaceMaskStyle, isImageTiled, getDuotoneColors, getTextWarpStyle, getTextCompensationTransform, renderTextSegments, buildReactChartViewModel, renderChartElement, buildInkGroupStrokes, getInkReplayStyles, INK_REPLAY_KEYFRAMES, buildContentPartStrokes, getContentPartReplayStyles, MIN_ELEMENT_SIZE, buildTextBody3DSceneStyle, getImageTilingStyle, buildCacheKey, DEFAULT_COLOR_CHANGE_TOLERANCE, getCachedResult, applyColorChange, setCachedResult, DEFAULT_TEXT_FONT_SIZE, DEFAULT_FONT_FAMILY, substituteFieldText, HYPERLINK_COLOR, cloneTemplateElementsBySlideId, cloneSlide, cloneHistorySnapshot, ZOOM_TO_SELECTION_PADDING, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, partitionTemplateElements, isTemplateElementId, DEFAULT_TABLE_ROWS, DEFAULT_TABLE_COLUMNS, comparePresentation, UNGROUPED_SECTION_ID, DEFAULT_SECTION_GROUP_ID, stopAllPersistentAudio, buildSaveSlides, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, makeCloneId, buildPdfFromTiledImageData, GRID_SIZE, copyFormatFromElement, hasCopyableFormat, rerouteConnectorsForMovedElements, applyReroutedConnectors, splitCell, mergeCells, buildNotesPdf, canvasToJpegData, applyFormatToElement, isPpactionUrl, parsePpactionUrl, isUrlSafe, computeSnapToShape, safeOpenUrl as safeOpenUrl$1 } from './chunk-FBN7UFW2.mjs';
2
- import { GlyphOutlineFontCache, createGlyphOutlineLookup, DEFAULT_VIEWER_OPTIONS, TOOLBAR_TABS, defineThreeViewElement, getSelectionControlArtworkStyle, svgLineCap, getSelectionOutlineColor, screenStrokeWidth, connectorWrapperTransform, resolveElementInteractivity, getBackgroundAnimationState, getShapeEffectLayerPlacement, buildTextStyleOverrideCss, isElementRendered, resolveElementAriaAttributes, isMediaFullscreenActive, shouldRenderHitTarget, elementHitTargetStyle, getShapeEffectAnimationLayerStyle, inlineElementPointerEvents, isHollowShapeElement, LINK_TOOLTIP_HOST_CLASS, mediaTransportVisible, oleActionsVisible, getGroupChildParentFill, getResizeHandleHitAreaStyle, paintedStrokeWidth, ensureActionAffordanceStyles, resolveElementActionAffordance, actionAffordanceLabels, paintedElementSize, MEDIA_FULLSCREEN_OVERLAY_STYLE, elementContainerHeightStyle, getAnimationOpacity, resolveElementHighlightClick, applyHighlightClickStyle, getComputedEffectStyle, getSoftEdgeSvgFilter, getEffectStyleSource, getBevelLightingSvgFilter, buildStrokeOutline, buildHollowHitOutline, buildSubpathFillOverlay, strokeOutlineViewBox, resolveRevealedSmartArtNodes, resolveRevealedDrawingShapes, buildSmartArtA11y, canDrillDown, computeSmartArtElementLayout, flattenNodes, buildSummaryZoomView, getImageColorWashStyle, readEditableText, placeCaretAt, takePendingCaretPoint, getPendingSelectionRestore, restoreSegmentSelection, mapInlineTextFormatKey, mapInlineEditorChord, subscribeBarFacePicturePixelSamples, getBarFacePicturePixelSampleVersion, ensureChartInteractionStyles, applyChartPartHighlight, resolveRevealedChartData, formatAxisValue, chartFormatTargetFromEvent, resolveOleType, getOleAriaLabel, getOleTypeColor, getOleTypeLabel, filterRenderedElements, resolveGroupChildFill, isLinkedTextBox, getOverflowSegments, shouldUseSvgWarp, getTextBodyRotationTransform, placeholderPromptDescriptor, getAriaRoleDescription as getAriaRoleDescription$1, getAriaLabel as getAriaLabel$1, attachRotateHandlePlacement, elementIdSelector, createRotationDrag, ACTION_INDICATOR_CLASS, ACTION_INDICATOR_ICON_PATH, LINK_TOOLTIP_CLASS, LINK_TOOLTIP_PANEL_CLASS, LINK_TOOLTIP_LABEL_CLASS, LINK_TOOLTIP_HINT_CLASS, SMARTART_DEFAULT_PALETTE, resolvePalette as resolvePalette$1, computeDrawingViewBox, projectDrawingShapes, resolveRevealedDrawingShapeNodeIds, styleShadowFilter, buildChromeStyle, measureSvgViewportRect, modelDataToBlobUrl, resolveZoomNavigationTarget, getImageSvgFilters, getCachedNativeImageSize, probeNativeImageSize, buildDuotoneCacheKey, getDuotoneCachedResult, applyDuotone, setDuotoneCachedResult, inlineListBodyText, createInlineListSeed, readListActivationSelection, createInlineListModelObserver, attachCollaborationInlineEditor, bindInlineListParagraph, bindInlineListRun, attachInlineListController, restoreInlineListBodySelection, getInlineEditorSelectionResult, isBulletMarkerSegment, resolveChartThreeViewSpec, applyChart3DDrag, applyChart3DSelect, findChartPartTarget, withChartTitle, resolveSmartArtThreeViewSpec, isBrowserOpenableMime, formatBytes, getOleDisplayName, getOleBadgeLabel, openUrlInNewTab, hasGlyphEnvelope, buildGlyphEnvelopeBlock, getWarpPath, resolveFontItalic, resolveFontWeight, isWedgeCalloutPresetShape, getAriaRole as getAriaRole$1, isElementActionable, centeredSvgTextLines, findSmartArtNodeText, rebuildDrawingShapesIfCleared, shouldCommitSmartArtNodeText, advanceChartMarkDrag, advanceChartValueDrag, resolveChartKind, buildChartMarkDragGeometry, beginChartMarkDrag, beginChartValueDrag, commitSmartArtNodeFill, commitSmartArtNodeText, groupIntoParagraphs as groupIntoParagraphs$1, computeInlineEditorRect, smartArtNodeAtPoint, MIN_TOUCH_TARGET_PX, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, createSyncGate, clearLocalAwareness, validateRoomId, createDepartureChannel, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, registerCollaborationTeardown, createPresenceProjector, BROADCAST_THROTTLE_MS, sanitizeColor, createWheelStepBuffer, createViewerZoomStore, clampZoomScale, mapEditingWheel, createActiveAnimationGroup, cancelBuildReveal, clearPlaybackTimers, PresentationAnimationController, resolveMediaTimeNodeElementIds, resolveMediaBookmarkTimesMs, advanceMainSequence, playGroup, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, clearAudienceContent, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, storeAudienceContent, isPresentationSessionMessage, endAudienceDisplay, createPresentationKeyBuffer, acceptsPresentationInput, resolveAutoAdvanceDelayMs, resolveForwardSlideWithZoomReturn, buildZoomTransitionOverride, hasShowSlideAfter, nextShowSlideIndex, previousShowSlideIndex, beginZoomExcursion, createPresenterShowGuard, firstShowSlideIndex, attachPresentationVisibilityPause, presentationEntrySlideIndex, buildMorphTransitionPlan, morphOptionToMode, buildMorphAnimationRules, findInSlides, applyFindReplacements, visibleTemplateElements, createCollaborationLivePatcher, publishLiveInlineText, initialInspectorOpen, createPresentationLoadResources, collectMediaElements, resolveMediaElementSource, collectImagePaths, applyImagePathPatches, resolveTableCellImageUrls, resolveTableStyleImageUrls, resolveTextFillBlipUrls, seedRecentColors, resolveAuthoredCustomShowId, buildInitialGuides, readOnlyRecommendation, compatibilityWarningToasts, resolveInitialSlideIndex, resolveAutosaveIntervalMs, shouldWriteAutosaveSnapshot, saveAutosaveSnapshot, autosaveSnapshotMark, updateMasterViewElement, updateElement, masterViewElements, replaceMasterViewElements, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, canMergeShapes, canInteractWithElement, prepareHtml2CanvasClone, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, resolveImageResolutionScale, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, describeFontEmbedding, isMobileViewport, resolveAuthoredSlideRange, mayLeaveSlideShow, buildDeckSaveOptions, resolveSlideSizeSelection, saveDeckWithPassword, shouldProbeAutosaveRecovery, probeAutosaveRecovery, acceptAutosaveRecovery, acknowledgeAutosaveRecovery, discardAutosaveRecovery, shouldLoopContinuously, applyRehearsalTimings, rasterResultToPngBlob, downloadBlob, elementPictureFilename, canEditElementPoints, selectTrustedEmbeddedFonts, collectReferencedFontFamilies, resolveGoogleWebfontHref, syncGoogleWebfontStylesheet, selectGoogleWebfontFamilies, fetchGoogleWebfontOutlineBytes, isFeatureEnabled, mapSlideShowStartKey, mapCustomizedEditorKey, isEditorControlTarget, isEditorTextInputTarget, parentSelection, textFontSizePtToPx, stepFontSizePt, textFontSizePxToPt, cycleSelectableElement, createCustomizationController, prepareElementForInsertion, slideSpaceElement, createViewerOptionsStore, observeYDocSlides, LOCAL_SYNC_ORIGIN, readSlidesFromYDoc, shouldRoomSlidesReplaceLoad, reconcileSlidesInYDoc, shouldAutoFollowBroadcaster, detectTouchDevice, detectOrientation, deriveViewportBreakpoints, createTouchGestureRecognizer, isKeyboardOpen, scopeLayoutOptionsToSlide, checkModifyPassword, viewerPreferencesFromViewProperties, DEFAULT_VIEWER_PREFERENCES, viewPropertiesPatchFromPreferences, resolveCollaborationConfig, openPptxFile, readBackstageRecentFile, resolveCollaborationShellEditability, resolveCollaborationShellState, deviceStrokeStageStyle, MORPH_CROSSFADE_GROUP_STYLE, MORPH_CROSSFADE_HALF_STYLE, getSlideTransitionAnimations, getFragmentedTransitionDescriptor, SLIDE_TRANSITION_KEYFRAMES, isActionHidden, buildInlineTextCommitPatch, resolveInlineEditAutoFitHeight, resolveInlineEditNormAutofitShrink, setPendingCaretPoint, drillSelectionForDoubleClick, filterInteractableIds, beginShapeAdjustment, buildElementClipboardPayload, contextMenuInspectorAnchor, savedPresentationFileName, exportDeckJson, groupElements, generateElementId, ungroupElements, alignElements, distributeElements, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, planMergeShapes, applyMergeShapesPlan, mapPresentationKey, lastShowSlideIndex, mapPresentationWheel, openPendingPrintWindow, computeColorFilter, filterHiddenSlideIndices, computeSlideIndices, buildPrintDocument, finishPrintWindow, buildPrintHtmlDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, insertSlidePaste, applySlidePasteTemplates, makeSlideId, buildSlideTemplateSlide, templateSchemeFromTheme, resolveViewportFitOptions, editorViewportFitFor, calculateViewportFit, scheduleAutoAdvanceChain, computeEntranceAnimationDelay, createPresentationSessionId, resolveTransitionDurationMs, resolveTransitionSoundAction, runPresentationAction, safeOpenUrl, buildRunProgramNotice, toggleStageElementMedia, resolveOleVerbTarget, downloadDataUrl, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, resetPresenterTimer, presenterElapsed, stepPresenterZoom, togglePresenterTimer, addCommentToList, removeCommentFromList, editCommentInList, toggleCommentResolvedInList, slideSpaceMembers, remapTextToSegments, buildInlineListStylePatch, applyActiveInlineListFormatting, applyListStyleUpdate, setPendingSelectionRestore, applyTextStyleUpdate, toggleSelectionBullets, transformInlineListCase, applyCaseTransformToSegments, transformTextCase, resolveExportCaptureDecision, recordProgressPercent, computeGridSpacingPx as computeGridSpacingPx$1, resolveShowSlideIndexes, groupSlidesBySection, masterViewPseudoSlide, overlayMasterViewInlineSnapshot, overlayInlineTextSnapshot, rasterizeElement, cloneElementForPaste, applyPasteSpecialFormat, buildRasterPictureElement, cloneElementUpdates, assertElementUpdateTarget, prepareElementUpdateBatch, createWriteBackScheduler, observeExternalCollaborationReadiness, resolveHistoryDepth, createBackstagePresentation, buildFieldSubstitutionContext, isEnterableGroup, memberChainAtPoint, findElementPath, drillSelectionForClick, scrollInspectorSectionIntoView, computeScrollDelta, replyToCommentInList, removeTableElementColumn, insertTableElementColumn, removeTableElementRow, insertTableElementRow, withCellStyle, setCellText, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, stopCaptureStream, GIF_POST_CAPTURE_MAX_SIDE, encodeGif, rasterizeElementTiles, placeTileOnPage, PDF_SLIDES_PAGE_WIDTH_PT, PDF_SLIDES_PAGE_HEIGHT_PT, createSnapshotTextPositions, resolvePresentationAction, buildSmartArtPresetData, classifyMediaType, publishLiveGeometry, getDraggedShapeAdjustments, computeMarqueeHitIds, mergeAdditiveSelection, rasterizeElementTiledToCanvas, borrowExternalCollaborationAwareness, observeExternalCollaborationSession, clampGifDimensions, rasterResultToPngDataUrl, shouldConfirmExternalHyperlink, applyResize, lockResizeAspect, snapBoxToGrid, applyMotionPathPreset, bringForward, sendBackward, bringToFront, sendToBack } from 'ooxml-ui/pptx';
2
+ import { GlyphOutlineFontCache, createGlyphOutlineLookup, DEFAULT_VIEWER_OPTIONS, TOOLBAR_TABS, defineThreeViewElement, getSelectionControlArtworkStyle, svgLineCap, getSelectionOutlineColor, screenStrokeWidth, connectorWrapperTransform, resolveElementInteractivity, getBackgroundAnimationState, getShapeEffectLayerPlacement, buildTextStyleOverrideCss, isElementRendered, resolveElementAriaAttributes, isMediaFullscreenActive, shouldRenderHitTarget, elementHitTargetStyle, getShapeEffectAnimationLayerStyle, inlineElementPointerEvents, isHollowShapeElement, LINK_TOOLTIP_HOST_CLASS, mediaTransportVisible, oleActionsVisible, getGroupChildParentFill, getResizeHandleHitAreaStyle, paintedStrokeWidth, ensureActionAffordanceStyles, resolveElementActionAffordance, actionAffordanceLabels, paintedElementSize, MEDIA_FULLSCREEN_OVERLAY_STYLE, elementContainerHeightStyle, getAnimationOpacity, resolveElementHighlightClick, applyHighlightClickStyle, getComputedEffectStyle, getSoftEdgeSvgFilter, getEffectStyleSource, getBevelLightingSvgFilter, buildStrokeOutline, buildHollowHitOutline, buildSubpathFillOverlay, strokeOutlineViewBox, resolveRevealedSmartArtNodes, resolveRevealedDrawingShapes, buildSmartArtA11y, canDrillDown, computeSmartArtElementLayout, flattenNodes, buildSummaryZoomView, getImageColorWashStyle, readEditableText, placeCaretAt, takePendingCaretPoint, getPendingSelectionRestore, restoreSegmentSelection, mapInlineTextFormatKey, mapInlineEditorChord, subscribeBarFacePicturePixelSamples, getBarFacePicturePixelSampleVersion, ensureChartInteractionStyles, applyChartPartHighlight, resolveRevealedChartData, formatAxisValue, chartFormatTargetFromEvent, resolveOleType, getOleAriaLabel, getOleTypeColor, getOleTypeLabel, filterRenderedElements, resolveGroupChildFill, isLinkedTextBox, getOverflowSegments, shouldUseSvgWarp, getTextBodyRotationTransform, placeholderPromptDescriptor, getAriaRoleDescription as getAriaRoleDescription$1, getAriaLabel as getAriaLabel$1, attachRotateHandlePlacement, elementIdSelector, createRotationDrag, ACTION_INDICATOR_CLASS, ACTION_INDICATOR_ICON_PATH, LINK_TOOLTIP_CLASS, LINK_TOOLTIP_PANEL_CLASS, LINK_TOOLTIP_LABEL_CLASS, LINK_TOOLTIP_HINT_CLASS, SMARTART_DEFAULT_PALETTE, resolvePalette as resolvePalette$1, computeDrawingViewBox, projectDrawingShapes, resolveRevealedDrawingShapeNodeIds, styleShadowFilter, buildChromeStyle, measureSvgViewportRect, modelDataToBlobUrl, resolveZoomNavigationTarget, getImageSvgFilters, getCachedNativeImageSize, probeNativeImageSize, buildDuotoneCacheKey, getDuotoneCachedResult, applyDuotone, setDuotoneCachedResult, inlineListBodyText, createInlineListSeed, readListActivationSelection, createInlineListModelObserver, attachCollaborationInlineEditor, bindInlineListParagraph, bindInlineListRun, attachInlineListController, restoreInlineListBodySelection, getInlineEditorSelectionResult, isBulletMarkerSegment, resolveChartThreeViewSpec, applyChart3DDrag, applyChart3DSelect, findChartPartTarget, withChartTitle, resolveSmartArtThreeViewSpec, isBrowserOpenableMime, formatBytes, getOleDisplayName, getOleBadgeLabel, openUrlInNewTab, hasGlyphEnvelope, buildGlyphEnvelopeBlock, getWarpPath, resolveFontItalic, resolveFontWeight, isWedgeCalloutPresetShape, getAriaRole as getAriaRole$1, isElementActionable, centeredSvgTextLines, findSmartArtNodeText, rebuildDrawingShapesIfCleared, shouldCommitSmartArtNodeText, advanceChartMarkDrag, advanceChartValueDrag, resolveChartKind, buildChartMarkDragGeometry, beginChartMarkDrag, beginChartValueDrag, commitSmartArtNodeFill, commitSmartArtNodeText, groupIntoParagraphs as groupIntoParagraphs$1, computeInlineEditorRect, smartArtNodeAtPoint, MIN_TOUCH_TARGET_PX, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, createSyncGate, clearLocalAwareness, validateRoomId, createDepartureChannel, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, registerCollaborationTeardown, createPresenceProjector, BROADCAST_THROTTLE_MS, sanitizeColor, createWheelStepBuffer, createViewerZoomStore, clampZoomScale, mapEditingWheel, createActiveAnimationGroup, cancelBuildReveal, clearPlaybackTimers, PresentationAnimationController, resolveMediaTimeNodeElementIds, resolveMediaBookmarkTimesMs, advanceMainSequence, playGroup, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, clearAudienceContent, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, storeAudienceContent, isPresentationSessionMessage, endAudienceDisplay, createPresentationKeyBuffer, acceptsPresentationInput, resolveAutoAdvanceDelayMs, resolveForwardSlideWithZoomReturn, buildZoomTransitionOverride, hasShowSlideAfter, nextShowSlideIndex, previousShowSlideIndex, beginZoomExcursion, createPresenterShowGuard, firstShowSlideIndex, attachPresentationVisibilityPause, presentationEntrySlideIndex, buildMorphTransitionPlan, morphOptionToMode, buildMorphAnimationRules, findInSlides, applyFindReplacements, visibleTemplateElements, createCollaborationLivePatcher, publishLiveInlineText, initialInspectorOpen, createPresentationLoadResources, collectMediaElements, resolveMediaElementSource, collectImagePaths, applyImagePathPatches, resolveTableCellImageUrls, resolveTableStyleImageUrls, resolveTextFillBlipUrls, seedRecentColors, resolveAuthoredCustomShowId, buildInitialGuides, readOnlyRecommendation, compatibilityWarningToasts, resolveInitialSlideIndex, resolveAutosaveIntervalMs, shouldWriteAutosaveSnapshot, saveAutosaveSnapshot, autosaveSnapshotMark, updateMasterViewElement, updateElement, masterViewElements, replaceMasterViewElements, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, canMergeShapes, canInteractWithElement, prepareHtml2CanvasClone, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, resolveImageResolutionScale, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, describeFontEmbedding, isMobileViewport, resolveAuthoredSlideRange, mayLeaveSlideShow, buildDeckSaveOptions, resolveSlideSizeSelection, saveDeckWithPassword, shouldProbeAutosaveRecovery, probeAutosaveRecovery, acceptAutosaveRecovery, acknowledgeAutosaveRecovery, discardAutosaveRecovery, shouldLoopContinuously, applyRehearsalTimings, rasterResultToPngBlob, downloadBlob, elementPictureFilename, canEditElementPoints, selectTrustedEmbeddedFonts, collectReferencedFontFamilies, resolveGoogleWebfontHref, syncGoogleWebfontStylesheet, selectGoogleWebfontFamilies, fetchGoogleWebfontOutlineBytes, isFeatureEnabled, mapSlideShowStartKey, mapCustomizedEditorKey, isEditorControlTarget, isEditorTextInputTarget, parentSelection, textFontSizePtToPx, stepFontSizePt, textFontSizePxToPt, cycleSelectableElement, createCustomizationController, prepareElementForInsertion, slideSpaceElement, createViewerOptionsStore, observeYDocSlides, LOCAL_SYNC_ORIGIN, readSlidesFromYDoc, shouldRoomSlidesReplaceLoad, reconcileSlidesInYDoc, shouldAutoFollowBroadcaster, detectTouchDevice, detectOrientation, deriveViewportBreakpoints, createTouchGestureRecognizer, isKeyboardOpen, scopeLayoutOptionsToSlide, checkModifyPassword, viewerPreferencesFromViewProperties, DEFAULT_VIEWER_PREFERENCES, viewPropertiesPatchFromPreferences, resolveCollaborationConfig, openPptxFile, readBackstageRecentFile, resolveCollaborationShellEditability, resolveCollaborationShellState, deviceStrokeStageStyle, MORPH_CROSSFADE_GROUP_STYLE, MORPH_CROSSFADE_HALF_STYLE, getSlideTransitionAnimations, getFragmentedTransitionDescriptor, SLIDE_TRANSITION_KEYFRAMES, isActionHidden, buildInlineTextCommitPatch, resolveInlineEditAutoFitHeight, resolveInlineEditNormAutofitShrink, setPendingCaretPoint, drillSelectionForDoubleClick, filterInteractableIds, beginShapeAdjustment, buildElementClipboardPayload, contextMenuInspectorAnchor, savedPresentationFileName, exportDeckJson, groupElements, generateElementId, ungroupElements, alignElements, distributeElements, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, planMergeShapes, applyMergeShapesPlan, mapPresentationKey, lastShowSlideIndex, mapPresentationWheel, openPendingPrintWindow, computeColorFilter, filterHiddenSlideIndices, computeSlideIndices, buildPrintDocument, finishPrintWindow, buildPrintHtmlDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, insertSlidePaste, applySlidePasteTemplates, makeSlideId, buildSlideTemplateSlide, templateSchemeFromTheme, needsOwnedSession, openOwnedCollaboration, resolveViewportFitOptions, editorViewportFitFor, calculateViewportFit, scheduleAutoAdvanceChain, computeEntranceAnimationDelay, createPresentationSessionId, resolveTransitionDurationMs, resolveTransitionSoundAction, runPresentationAction, safeOpenUrl, buildRunProgramNotice, toggleStageElementMedia, resolveOleVerbTarget, downloadDataUrl, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, resetPresenterTimer, presenterElapsed, stepPresenterZoom, togglePresenterTimer, addCommentToList, removeCommentFromList, editCommentInList, toggleCommentResolvedInList, slideSpaceMembers, remapTextToSegments, buildInlineListStylePatch, applyActiveInlineListFormatting, applyListStyleUpdate, setPendingSelectionRestore, applyTextStyleUpdate, toggleSelectionBullets, transformInlineListCase, applyCaseTransformToSegments, transformTextCase, resolveExportCaptureDecision, recordProgressPercent, computeGridSpacingPx as computeGridSpacingPx$1, resolveShowSlideIndexes, groupSlidesBySection, masterViewPseudoSlide, overlayMasterViewInlineSnapshot, overlayInlineTextSnapshot, rasterizeElement, cloneElementForPaste, applyPasteSpecialFormat, buildRasterPictureElement, cloneElementUpdates, assertElementUpdateTarget, prepareElementUpdateBatch, createWriteBackScheduler, observeExternalCollaborationReadiness, resolveHistoryDepth, createBackstagePresentation, buildFieldSubstitutionContext, isEnterableGroup, memberChainAtPoint, findElementPath, drillSelectionForClick, scrollInspectorSectionIntoView, computeScrollDelta, replyToCommentInList, removeTableElementColumn, insertTableElementColumn, removeTableElementRow, insertTableElementRow, withCellStyle, setCellText, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, stopCaptureStream, GIF_POST_CAPTURE_MAX_SIDE, encodeGif, rasterizeElementTiles, placeTileOnPage, PDF_SLIDES_PAGE_WIDTH_PT, PDF_SLIDES_PAGE_HEIGHT_PT, createSnapshotTextPositions, resolvePresentationAction, buildSmartArtPresetData, classifyMediaType, publishLiveGeometry, getDraggedShapeAdjustments, computeMarqueeHitIds, mergeAdditiveSelection, rasterizeElementTiledToCanvas, borrowExternalCollaborationAwareness, observeExternalCollaborationSession, clampGifDimensions, rasterResultToPngDataUrl, shouldConfirmExternalHyperlink, applyResize, lockResizeAspect, snapBoxToGrid, applyMotionPathPreset, bringForward, sendBackward, bringToFront, sendToBack } from 'ooxml-ui/pptx';
3
3
  export { DUOTONE_PRESETS, MOBILE_BREAKPOINT, SLIDE_TRANSITION_KEYFRAMES, TABLET_BREAKPOINT, clearAudienceContent, computeVirtualRange, downloadBlob, getSlideTransitionAnimations, loadAudienceContent, storeAudienceContent } from 'ooxml-ui/pptx';
4
4
  import React17, { createContext, useMemo, useState, useCallback, useEffect, Suspense, useRef, useLayoutEffect, useContext, useSyncExternalStore, useImperativeHandle } from 'react';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -492,15 +492,70 @@ function useCollaborationSession({ config }) {
492
492
  const external = useExternalYjsSession(config?.externalSession);
493
493
  return config?.externalSession ? external : owned;
494
494
  }
495
+ function useOwnedCollaboration(config) {
496
+ const needs = Boolean(config && needsOwnedSession(config));
497
+ const [opened, setOpened] = useState(null);
498
+ useEffect(() => {
499
+ if (!config || !needsOwnedSession(config)) {
500
+ return;
501
+ }
502
+ const owned = openOwnedCollaboration(config);
503
+ let live = true;
504
+ owned.ready.then(
505
+ (prepared) => {
506
+ if (live && prepared) {
507
+ setOpened({ source: config, prepared });
508
+ }
509
+ },
510
+ () => {
511
+ if (live) {
512
+ setOpened({ failed: true });
513
+ }
514
+ }
515
+ );
516
+ return () => {
517
+ live = false;
518
+ owned.release();
519
+ setOpened(null);
520
+ };
521
+ }, [
522
+ needs,
523
+ config?.roomId,
524
+ config?.provider,
525
+ config?.serverUrl,
526
+ config?.transport,
527
+ config?.role,
528
+ config?.userName,
529
+ config?.userColor,
530
+ config?.userAvatar
531
+ ]);
532
+ return useMemo(() => {
533
+ if (!needs) {
534
+ return { config, holding: false, status: void 0 };
535
+ }
536
+ if (opened && "prepared" in opened) {
537
+ return {
538
+ config: { ...config, externalSession: opened.prepared.externalSession },
539
+ holding: false,
540
+ status: void 0
541
+ };
542
+ }
543
+ return { config, holding: true, status: opened ? "error" : "connecting" };
544
+ }, [needs, config, opened]);
545
+ }
495
546
 
496
547
  // src/viewer/hooks/collaboration/useCollaborativeState.ts
497
548
  function useCollaborativeState({
498
- config,
549
+ config: requested,
499
550
  canvasWidth,
500
551
  canvasHeight
501
552
  }) {
553
+ const ownedSession = useOwnedCollaboration(requested);
554
+ const config = ownedSession.config;
502
555
  const userColor = sanitizeColor(config?.userColor, "#6366f1");
503
- const { status, awareness, doc, clientId, synced, retry } = useCollaborationSession({ config });
556
+ const session = useCollaborationSession({ config: ownedSession.holding ? void 0 : config });
557
+ const { awareness, doc, clientId, synced, retry } = session;
558
+ const status = ownedSession.status ?? session.status;
504
559
  const { remoteUsers, broadcastPresence } = usePresenceTracking({
505
560
  awareness,
506
561
  localClientId: clientId,
@@ -513,8 +568,18 @@ function useCollaborativeState({
513
568
  });
514
569
  const connectedCount = status === "connected" ? remoteUsers.length + 1 : remoteUsers.length;
515
570
  return useMemo(
516
- () => config ? { status, remoteUsers, broadcastPresence, connectedCount, config, doc, synced, retry } : null,
517
- [status, remoteUsers, broadcastPresence, connectedCount, config, doc, synced, retry]
571
+ () => config ? {
572
+ status,
573
+ remoteUsers,
574
+ broadcastPresence,
575
+ connectedCount,
576
+ config,
577
+ doc,
578
+ synced,
579
+ retry,
580
+ clientId
581
+ } : null,
582
+ [status, remoteUsers, broadcastPresence, connectedCount, config, doc, synced, retry, clientId]
518
583
  );
519
584
  }
520
585
  var CollaborationContext = createContext(null);
@@ -13146,6 +13211,7 @@ function useViewPreferencesSync(input) {
13146
13211
  // src/viewer/hooks/useViewerBuildingBlocksState.ts
13147
13212
  function useViewerBuildingBlocksState(input) {
13148
13213
  const { core, content, canEdit, filePath, autosaveEnabled, userName, handle, setContent } = input;
13214
+ const { initialSlide } = input;
13149
13215
  const {
13150
13216
  onContentChange,
13151
13217
  onDirtyChange,
@@ -13248,6 +13314,7 @@ function useViewerBuildingBlocksState(input) {
13248
13314
  content,
13249
13315
  filePath,
13250
13316
  autosaveEnabled,
13317
+ initialSlide,
13251
13318
  // Trust Center > "Allow external content": same gate `PowerPointViewer`
13252
13319
  // applies, so the headless building-blocks API loads http(s) images
13253
13320
  // under the same default-off, core-side SSRF/privacy guard.
@@ -13311,6 +13378,7 @@ function useViewerBuildingBlocks(input) {
13311
13378
  canEdit: requestedCanEdit = false,
13312
13379
  filePath,
13313
13380
  fileName,
13381
+ initialSlide,
13314
13382
  autosaveEnabled = true,
13315
13383
  userName,
13316
13384
  hiddenActions,
@@ -13398,6 +13466,7 @@ function useViewerBuildingBlocks(input) {
13398
13466
  content,
13399
13467
  canEdit,
13400
13468
  filePath,
13469
+ initialSlide,
13401
13470
  autosaveEnabled,
13402
13471
  userName,
13403
13472
  handle,
Binary file
Binary file