pptx-react-viewer 3.20.1 → 4.0.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 +30 -0
- package/dist/{AiChatPanel-7AU4A3A7.mjs → AiChatPanel-MHURGN6G.mjs} +3 -3
- package/dist/AiChatPanel-MHURGN6G.mjs.br +0 -0
- package/dist/AiChatPanel-MHURGN6G.mjs.gz +0 -0
- package/dist/{AiChatPanel-FIUTFT55.js → AiChatPanel-WMVQFNDC.js} +24 -24
- package/dist/AiChatPanel-WMVQFNDC.js.br +0 -0
- package/dist/AiChatPanel-WMVQFNDC.js.gz +0 -0
- package/dist/{Area3DChartScene-ZGVLTYDW.js → Area3DChartScene-IMGZEZNU.js} +2 -2
- package/dist/Area3DChartScene-IMGZEZNU.js.br +0 -0
- package/dist/Area3DChartScene-IMGZEZNU.js.gz +0 -0
- package/dist/{Area3DChartScene-SPRHDMNQ.mjs → Area3DChartScene-LKOWSMAU.mjs} +1 -1
- package/dist/{Area3DChartScene-SPRHDMNQ.mjs.br → Area3DChartScene-LKOWSMAU.mjs.br} +0 -0
- package/dist/Area3DChartScene-LKOWSMAU.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-FJCRJCZV.mjs → Bar3DChartScene-NQNSIMUL.mjs} +1 -1
- package/dist/{Bar3DChartScene-FJCRJCZV.mjs.br → Bar3DChartScene-NQNSIMUL.mjs.br} +0 -0
- package/dist/Bar3DChartScene-NQNSIMUL.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-GVIX7ENI.js → Bar3DChartScene-VLSYVFRT.js} +2 -2
- package/dist/Bar3DChartScene-VLSYVFRT.js.br +0 -0
- package/dist/Bar3DChartScene-VLSYVFRT.js.gz +0 -0
- package/dist/{Line3DChartScene-KP4RMVAQ.mjs → Line3DChartScene-ANZBJYQI.mjs} +1 -1
- package/dist/{Line3DChartScene-KP4RMVAQ.mjs.br → Line3DChartScene-ANZBJYQI.mjs.br} +0 -0
- package/dist/Line3DChartScene-ANZBJYQI.mjs.gz +0 -0
- package/dist/{Line3DChartScene-6C3WDA42.js → Line3DChartScene-IWZHA563.js} +2 -2
- package/dist/Line3DChartScene-IWZHA563.js.br +0 -0
- package/dist/Line3DChartScene-IWZHA563.js.gz +0 -0
- package/dist/{Model3DScene-SXZYGMN6.js → Model3DScene-2L3YRAMR.js} +2 -2
- package/dist/Model3DScene-2L3YRAMR.js.br +0 -0
- package/dist/Model3DScene-2L3YRAMR.js.gz +0 -0
- package/dist/{Model3DScene-SH6ZLOXE.mjs → Model3DScene-Y34HTZXK.mjs} +1 -1
- package/dist/Model3DScene-Y34HTZXK.mjs.br +0 -0
- package/dist/Model3DScene-Y34HTZXK.mjs.gz +0 -0
- package/dist/{PieChart3DScene-F4IE7565.mjs → PieChart3DScene-FBRPLHLG.mjs} +1 -1
- package/dist/{PieChart3DScene-F4IE7565.mjs.br → PieChart3DScene-FBRPLHLG.mjs.br} +0 -0
- package/dist/PieChart3DScene-FBRPLHLG.mjs.gz +0 -0
- package/dist/{PieChart3DScene-V2Q73UEQ.js → PieChart3DScene-NE3GN5VG.js} +2 -2
- package/dist/PieChart3DScene-NE3GN5VG.js.br +0 -0
- package/dist/PieChart3DScene-NE3GN5VG.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-AXLDY5BB.mjs → SurfaceChart3DScene-7HE5DA3X.mjs} +1 -1
- package/dist/SurfaceChart3DScene-7HE5DA3X.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-7HE5DA3X.mjs.gz +0 -0
- package/dist/{SurfaceChart3DScene-XUGVYHD2.js → SurfaceChart3DScene-OSMAVZJC.js} +2 -2
- package/dist/SurfaceChart3DScene-OSMAVZJC.js.br +0 -0
- package/dist/SurfaceChart3DScene-OSMAVZJC.js.gz +0 -0
- package/dist/{chunk-MWNB4BX5.mjs → chunk-33YE6E2O.mjs} +563 -183
- package/dist/chunk-33YE6E2O.mjs.br +0 -0
- package/dist/chunk-33YE6E2O.mjs.gz +0 -0
- package/dist/{chunk-OKIHMWGI.mjs → chunk-5F426BCZ.mjs} +1 -1
- package/dist/chunk-5F426BCZ.mjs.br +0 -0
- package/dist/chunk-5F426BCZ.mjs.gz +0 -0
- package/dist/{chunk-F65J67TW.mjs → chunk-GITM3RKP.mjs} +1 -1
- package/dist/chunk-GITM3RKP.mjs.br +0 -0
- package/dist/chunk-GITM3RKP.mjs.gz +0 -0
- package/dist/{chunk-GV6LVDBE.mjs → chunk-H7J4EYXS.mjs} +58 -36
- package/dist/chunk-H7J4EYXS.mjs.br +0 -0
- package/dist/chunk-H7J4EYXS.mjs.gz +0 -0
- package/dist/{chunk-2BQKGTIF.js → chunk-I5F3XLVR.js} +1101 -1079
- package/dist/chunk-I5F3XLVR.js.br +0 -0
- package/dist/chunk-I5F3XLVR.js.gz +0 -0
- package/dist/{chunk-JIP6BCRV.mjs → chunk-IWHZ2DUD.mjs} +452 -257
- package/dist/chunk-IWHZ2DUD.mjs.br +0 -0
- package/dist/chunk-IWHZ2DUD.mjs.gz +0 -0
- package/dist/{chunk-ML4MTTPV.js → chunk-L6I73WMO.js} +1217 -1022
- package/dist/chunk-L6I73WMO.js.br +0 -0
- package/dist/chunk-L6I73WMO.js.gz +0 -0
- package/dist/{chunk-HN5QJSVB.js → chunk-LAAXFMRE.js} +566 -182
- package/dist/chunk-LAAXFMRE.js.br +0 -0
- package/dist/chunk-LAAXFMRE.js.gz +0 -0
- package/dist/chunk-MRWGWKA2.mjs +1076 -0
- package/dist/chunk-MRWGWKA2.mjs.br +0 -0
- package/dist/chunk-MRWGWKA2.mjs.gz +0 -0
- package/dist/{chunk-U46O2NL5.js → chunk-NKACTGK5.js} +173 -173
- package/dist/chunk-NKACTGK5.js.br +0 -0
- package/dist/chunk-NKACTGK5.js.gz +0 -0
- package/dist/chunk-YQQXFRZT.js +1160 -0
- package/dist/chunk-YQQXFRZT.js.br +0 -0
- package/dist/chunk-YQQXFRZT.js.gz +0 -0
- package/dist/{chunk-K7TAGREH.js → chunk-ZOB6ITIM.js} +5 -5
- package/dist/chunk-ZOB6ITIM.js.br +0 -0
- package/dist/chunk-ZOB6ITIM.js.gz +0 -0
- package/dist/index.d.ts +60 -2
- package/dist/index.js +46 -46
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +75 -43
- package/dist/internals.js +104 -104
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +3 -3
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/viewer/index.d.ts +70 -6
- package/dist/viewer/index.js +26 -26
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +5 -5
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/dist/{y-webrtc-TAJBJIKH.js → y-webrtc-6H3ROPRC.js} +1079 -128
- package/dist/y-webrtc-6H3ROPRC.js.br +0 -0
- package/dist/y-webrtc-6H3ROPRC.js.gz +0 -0
- package/dist/{y-webrtc-7DLWG3LJ.mjs → y-webrtc-XJDH2YTR.mjs} +984 -33
- package/dist/y-webrtc-XJDH2YTR.mjs.br +0 -0
- package/dist/y-webrtc-XJDH2YTR.mjs.gz +0 -0
- package/dist/{y-websocket-YRPS7AFF.js → y-websocket-6ISNPON7.js} +79 -80
- package/dist/y-websocket-6ISNPON7.js.br +0 -0
- package/dist/y-websocket-6ISNPON7.js.gz +0 -0
- package/dist/{y-websocket-HUEA7LH7.mjs → y-websocket-SJ3NCLBZ.mjs} +3 -4
- package/dist/y-websocket-SJ3NCLBZ.mjs.br +0 -0
- package/dist/y-websocket-SJ3NCLBZ.mjs.gz +0 -0
- package/package.json +8 -5
- package/dist/AiChatPanel-7AU4A3A7.mjs.br +0 -0
- package/dist/AiChatPanel-7AU4A3A7.mjs.gz +0 -0
- package/dist/AiChatPanel-FIUTFT55.js.br +0 -0
- package/dist/AiChatPanel-FIUTFT55.js.gz +0 -0
- package/dist/Area3DChartScene-SPRHDMNQ.mjs.gz +0 -0
- package/dist/Area3DChartScene-ZGVLTYDW.js.br +0 -0
- package/dist/Area3DChartScene-ZGVLTYDW.js.gz +0 -0
- package/dist/Bar3DChartScene-FJCRJCZV.mjs.gz +0 -0
- package/dist/Bar3DChartScene-GVIX7ENI.js.br +0 -0
- package/dist/Bar3DChartScene-GVIX7ENI.js.gz +0 -0
- package/dist/Line3DChartScene-6C3WDA42.js.br +0 -0
- package/dist/Line3DChartScene-6C3WDA42.js.gz +0 -0
- package/dist/Line3DChartScene-KP4RMVAQ.mjs.gz +0 -0
- package/dist/Model3DScene-SH6ZLOXE.mjs.br +0 -0
- package/dist/Model3DScene-SH6ZLOXE.mjs.gz +0 -0
- package/dist/Model3DScene-SXZYGMN6.js.br +0 -0
- package/dist/Model3DScene-SXZYGMN6.js.gz +0 -0
- package/dist/PieChart3DScene-F4IE7565.mjs.gz +0 -0
- package/dist/PieChart3DScene-V2Q73UEQ.js.br +0 -0
- package/dist/PieChart3DScene-V2Q73UEQ.js.gz +0 -0
- package/dist/SurfaceChart3DScene-AXLDY5BB.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-AXLDY5BB.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-XUGVYHD2.js.br +0 -0
- package/dist/SurfaceChart3DScene-XUGVYHD2.js.gz +0 -0
- package/dist/chunk-2BQKGTIF.js.br +0 -0
- package/dist/chunk-2BQKGTIF.js.gz +0 -0
- package/dist/chunk-DWIIYEOG.mjs +0 -9596
- package/dist/chunk-DWIIYEOG.mjs.br +0 -0
- package/dist/chunk-DWIIYEOG.mjs.gz +0 -0
- package/dist/chunk-F65J67TW.mjs.br +0 -0
- package/dist/chunk-F65J67TW.mjs.gz +0 -0
- package/dist/chunk-FXGO5KLU.mjs +0 -304
- package/dist/chunk-FXGO5KLU.mjs.br +0 -0
- package/dist/chunk-FXGO5KLU.mjs.gz +0 -0
- package/dist/chunk-GV6LVDBE.mjs.br +0 -0
- package/dist/chunk-GV6LVDBE.mjs.gz +0 -0
- package/dist/chunk-HN5QJSVB.js.br +0 -0
- package/dist/chunk-HN5QJSVB.js.gz +0 -0
- package/dist/chunk-JIP6BCRV.mjs.br +0 -0
- package/dist/chunk-JIP6BCRV.mjs.gz +0 -0
- package/dist/chunk-K7TAGREH.js.br +0 -0
- package/dist/chunk-K7TAGREH.js.gz +0 -0
- package/dist/chunk-ML4MTTPV.js.br +0 -0
- package/dist/chunk-ML4MTTPV.js.gz +0 -0
- package/dist/chunk-MWNB4BX5.mjs.br +0 -0
- package/dist/chunk-MWNB4BX5.mjs.gz +0 -0
- package/dist/chunk-NB7M4XBG.js +0 -318
- package/dist/chunk-NB7M4XBG.js.br +0 -0
- package/dist/chunk-NB7M4XBG.js.gz +0 -0
- package/dist/chunk-OKIHMWGI.mjs.br +0 -0
- package/dist/chunk-OKIHMWGI.mjs.gz +0 -0
- package/dist/chunk-U46O2NL5.js.br +0 -0
- package/dist/chunk-U46O2NL5.js.gz +0 -0
- package/dist/chunk-ZYQT7I5C.js +0 -9743
- package/dist/chunk-ZYQT7I5C.js.br +0 -0
- package/dist/chunk-ZYQT7I5C.js.gz +0 -0
- package/dist/y-webrtc-7DLWG3LJ.mjs.br +0 -0
- package/dist/y-webrtc-7DLWG3LJ.mjs.gz +0 -0
- package/dist/y-webrtc-TAJBJIKH.js.br +0 -0
- package/dist/y-webrtc-TAJBJIKH.js.gz +0 -0
- package/dist/y-websocket-HUEA7LH7.mjs.br +0 -0
- package/dist/y-websocket-HUEA7LH7.mjs.gz +0 -0
- package/dist/y-websocket-YRPS7AFF.js.br +0 -0
- package/dist/y-websocket-YRPS7AFF.js.gz +0 -0
- package/dist/yjs-4ED7E5CZ.mjs +0 -2
- package/dist/yjs-4ED7E5CZ.mjs.br +0 -0
- package/dist/yjs-4ED7E5CZ.mjs.gz +0 -0
- package/dist/yjs-OWUA3UHD.js +0 -419
- package/dist/yjs-OWUA3UHD.js.br +0 -0
- package/dist/yjs-OWUA3UHD.js.gz +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_STROKE_COLOR, getConnectorPathGeometry, buildLineShadowCss, buildLineGlowFilter, renderConnectorMarker, getShapeVisualStyle, getTextStyleForElement, DEFAULT_TEXT_COLOR, renderVectorShape, isConnectorOrLineElement, build3DExtrusionData, getImageRenderStyle, cn, getImageSurfaceStyle, getTextLayoutStyle, renderTableElement, renderMediaElement, shouldRenderFallbackLabel, DEFAULT_FILL_COLOR, getCropShapeClipPath, hasDagDuotoneEffect, renderDagDuotoneSvgFilter, getImageSurfaceMaskStyle, getImageTilingStyle, getDuotoneColors, getTextWarpStyle, renderTextSegments, buildReactChartViewModel, renderChartElement, MIN_ELEMENT_SIZE, buildTextBody3DSceneStyle, DEFAULT_TEXT_FONT_SIZE, DEFAULT_FONT_FAMILY, HYPERLINK_COLOR, cloneHistorySnapshot, ZOOM_TO_SELECTION_PADDING, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, UNGROUPED_SECTION_ID, DEFAULT_SECTION_GROUP_ID, DEFAULT_TABLE_ROWS, DEFAULT_TABLE_COLUMNS, buildPdfFromTiledImageData, buildNotesPdf, GRID_SIZE } from './chunk-
|
|
2
|
-
import { GlyphOutlineFontCache, createGlyphOutlineLookup, DEFAULT_VIEWER_OPTIONS, TOOLBAR_TABS, getSelectionControlArtworkStyle, hasShapeProperties, normalizeHexColor, colorWithOpacity, normalizeStrokeDashType, getSvgStrokeDasharray, getCompoundLineOffsets, getCompoundLineWidths, svgLineCap, hasTextProperties, getSelectionOutlineColor, connectorWrapperTransform, getAriaRoleDescription, getAriaLabel, getAriaRole, resolveElementInteractivity, isEditableTextElement, buildTextStyleOverrideCss, isElementRendered, resolveElementAriaAttributes, shouldRenderHitTarget, elementHitTargetStyle, getImageEffectsOpacity, getImageEffectsFilter, inlineElementPointerEvents, isHollowShapeElement, LINK_TOOLTIP_HOST_CLASS, ACTION_BUTTON_PRESETS, mediaTransportVisible, isInkElement, getGroupChildParentFill, getElementLabel, getResizeHandleHitAreaStyle, paintedStrokeWidth, buildCssGradientFromShapeStyle, ensureActionAffordanceStyles, resolveElementActionAffordance, actionAffordanceLabels, paintedElementSize, getElementTransform, resolveElementHighlightClick, applyHighlightClickStyle, getComputedEffectStyle, getSoftEdgeSvgFilter, getEffectStyleSource, getBevelLightingSvgFilter, buildStrokeOutline, buildHollowHitOutline, buildSubpathFillOverlay, isImageLikeElement, strokeOutlineViewBox, resolveRevealedSmartArtNodes, resolveRevealedDrawingShapes, buildSmartArtA11y, canDrillDown, computeSmartArtElementLayout, flattenNodes, buildSummaryZoomView, isImageTiled, getImageColorWashStyle, readEditableText, placeCaretAtEnd, getPendingSelectionRestore, restoreSegmentSelection, getTextCompensationTransform, resolveChartKind, subscribeBarFacePicturePixelSamples, getBarFacePicturePixelSampleVersion, ensureChartInteractionStyles, applyChartPartHighlight, resolveRevealedChartData, formatAxisValue, buildInkGroupStrokes, getInkReplayStyles, INK_REPLAY_KEYFRAMES, buildContentPartStrokes, getContentPartReplayStyles, resolveOleType, getOleAriaLabel, getOleTypeColor, getOleTypeLabel, filterRenderedElements, resolveGroupChildFill, isLinkedTextBox, getOverflowSegments, shouldUseSvgWarp, getTextBodyRotationTransform, placeholderPromptDescriptor, 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, DEFAULT_PALETTE2, resolvePalette, computeDrawingViewBox, projectDrawingShapes, resolveRevealedDrawingShapeNodeIds, styleShadowFilter, buildChromeStyle, measureSvgViewportRect, modelDataToBlobUrl, getImageSvgFilters, buildDuotoneCacheKey, getDuotoneCachedResult, applyDuotone, setDuotoneCachedResult, buildCacheKey, DEFAULT_COLOR_CHANGE_TOLERANCE, getCachedResult, applyColorChange, setCachedResult, inlineListBodyText, createInlineListSeed, readListActivationSelection, createInlineListModelObserver, bindInlineListParagraph, bindInlineListRun, attachInlineListController, restoreInlineListBodySelection, getInlineEditorSelectionResult, isBulletMarkerSegment, findChartPartTarget, buildSurfaceChart3DDataForElement, buildBarChart3DDataForElement, buildLineChart3DDataForElement, buildAreaChart3DDataForElement, buildPieChart3DDataForElement, withChartTitle, buildSmartArt3DModel, collectCoherent3DOffNodeIds, isBrowserOpenableMime, formatBytes, getOleDisplayName, getOleBadgeLabel, openUrlInNewTab, getSubstituteFontFamily, hasGlyphEnvelope, buildGlyphEnvelope, getWarpPath, isWedgeCalloutPresetShape, isElementActionable, centeredSvgTextLines, findSmartArtNodeText, setSmartArtNodeStyle, rebuildDrawingShapesIfCleared, shouldCommitSmartArtNodeText, updateSmartArtNodeText, advanceChartMarkDrag, advanceChartValueDrag, buildChartMarkDragGeometry, beginChartMarkDrag, beginChartValueDrag, groupIntoParagraphs, substituteFieldText, computeInlineEditorRect, withChartPointValue, MIN_TOUCH_TARGET_PX, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, createPresenceProjector, BROADCAST_THROTTLE_MS, createSyncGate, clearLocalAwareness, validateRoomId, createDepartureChannel, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, registerCollaborationTeardown, sanitizeColor, cloneTemplateElementsBySlideId, cloneSlide, createWheelStepBuffer, createViewerZoomStore, clampZoomScale, mapEditingWheel, createActiveAnimationGroup, cancelBuildReveal, clearPlaybackTimers, PresentationAnimationController, resolveMediaTimeNodeElementIds, advanceMainSequence, playGroup, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, clearAudienceContent, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, storeAudienceContent, isPresentationSessionMessage, endAudienceDisplay, createPresentationKeyBuffer, acceptsPresentationInput, resolveAutoAdvanceDelayMs, hasShowSlideAfter, nextShowSlideIndex, previousShowSlideIndex, createPresenterShowGuard, firstShowSlideIndex, attachPresentationVisibilityPause, presentationEntrySlideIndex, buildMorphTransitionPlan, morphOptionToMode, buildMorphAnimationRules, findInSlides, applyFindReplacements, visibleTemplateElements, createCollaborationLivePatcher, publishLiveInlineText, PptxHandler, createPresentationLoadResources, collectMediaElements, resolveMediaElementSource, collectImagePaths, applyImagePathPatches, resolveTableCellImageUrls, resolveTableStyleImageUrls, partitionTemplateElements, seedRecentColors, resolveAuthoredCustomShowId, buildInitialGuides, readOnlyRecommendation, compatibilityWarningToasts, EncryptedFileError, resolveAutosaveIntervalMs, shouldWriteAutosaveSnapshot, saveAutosaveSnapshot, autosaveSnapshotMark, updateMasterViewElement, isTemplateElementId, updateElement, masterViewElements, replaceMasterViewElements, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, canInteractWithElement, prepareExportClone, normalizeColorsForCapture, preprocessCssForCapture, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, resolveImageResolutionScale, applyThemeToData, THEME_PRESETS, themeColorSchemesEqual, comparePresentation, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, describeFontEmbedding, isMobileViewport, resolveAuthoredSlideRange, mayLeaveSlideShow, stopAllPersistentAudio, guidePxToEmu, buildSaveSlides, buildDeckSaveOptions, resolveSlideSizeSelection, saveDeckWithPassword, shouldProbeAutosaveRecovery, probeAutosaveRecovery, acceptAutosaveRecovery, discardAutosaveRecovery, shouldLoopContinuously, applyRehearsalTimings, copyFormatFromElement, applyFormatToElement, collectReferencedFontFamilies, resolveGoogleWebfontHref, syncGoogleWebfontStylesheet, selectGoogleWebfontFamilies, fetchGoogleWebfontOutlineBytes, mapSlideShowStartKey, mapEditorKey, isEditorTextInputTarget, prepareElementForInsertion, createViewerOptionsStore, readSlidesFromYDoc, shouldRoomSlidesReplaceLoad, reconcileSlidesInYDoc, LOCAL_SYNC_ORIGIN, observeYDocSlides, shouldAutoFollowBroadcaster, detectTouchDevice, detectOrientation, deriveViewportBreakpoints, createTouchGestureRecognizer, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, isKeyboardOpen, scopeLayoutOptionsToSlide, checkModifyPassword, viewerPreferencesFromViewProperties, DEFAULT_VIEWER_PREFERENCES, viewPropertiesPatchFromPreferences, openPptxFile, readBackstageRecentFile, MORPH_CROSSFADE_GROUP_STYLE, MORPH_CROSSFADE_HALF_STYLE, getSlideTransitionAnimations, getFragmentedTransitionDescriptor, SLIDE_TRANSITION_KEYFRAMES, isActionHidden, buildInlineTextCommitPatch, resolveInlineEditAutoFitHeight, resolveInlineEditNormAutofitShrink, filterInteractableIds, beginShapeAdjustment, buildElementClipboardPayload, savedPresentationFileName, downloadBlob, exportDeckJson, groupElements, generateElementId, makeCloneId, ungroupElements, alignElements, distributeElements, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, mergeShapes, mapPresentationKey, lastShowSlideIndex, mapPresentationWheel, openPendingPrintWindow, computeColorFilter, filterHiddenSlideIndices, computeSlideIndices, buildPrintDocument, finishPrintWindow, buildPrintHtmlDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, makeSlideId, buildSlideTemplateSlide, templateSchemeFromTheme, buildThemeColorMap, reResolveSlideColors, reResolveElementColors, resolveViewportFitOptions, calculateViewportFit, scheduleAutoAdvanceChain, computeEntranceAnimationDelay, createPresentationSessionId, resolveTransitionDurationMs, resolveTransitionSoundAction, runPresentationAction, safeOpenUrl, buildRunProgramNotice, toggleStageElementMedia, resolveOleVerbTarget, downloadDataUrl, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, resetPresenterTimer, presenterElapsed, stepPresenterZoom, togglePresenterTimer, addCommentToList, removeCommentFromList, editCommentInList, toggleCommentResolvedInList, remapTextToSegments, buildInlineListStylePatch, applyActiveInlineListFormatting, applyListStyleUpdate, setPendingSelectionRestore, applyTextStyleUpdate, toggleSelectionBullets, transformInlineListCase, applyCaseTransformToSegments, transformTextCase, resolveExportCaptureDecision, recordProgressPercent, computeGridSpacingPx, resolveShowSlideIndexes, groupSlidesBySection, masterViewPseudoSlide, overlayMasterViewInlineSnapshot, overlayInlineTextSnapshot, cloneElementUpdates, assertElementUpdateTarget, prepareElementUpdateBatch, resolveHistoryDepth, hasCopyableFormat, createBackstagePresentation, buildFieldSubstitutionContext, cloneElementForPaste, computeScrollDelta, getPresetShapeClipPath, svgPathToPolygons, polygonsToSvgPath, rerouteConnectorsForMovedElements, applyReroutedConnectors, SvgExporter, replyToCommentInList, removeTableElementColumn, insertTableElementColumn, removeTableElementRow, insertTableElementRow, updateCellTextStyleInRawXml, setCellText, updateCellTextInRawXml, splitCell, updateMergeAttrsInRawXml, mergeCells, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, stopCaptureStream, GIF_POST_CAPTURE_MAX_SIDE, encodeGif, rasterResultToPngBlob, rasterizeElementTiles, placeTileOnPage, PDF_SLIDES_PAGE_WIDTH_PT, PDF_SLIDES_PAGE_HEIGHT_PT, canvasToJpegData, rasterizeElementTiledToCanvas, isPpactionUrl, parsePpactionUrl, resolvePresentationAction, elementActionToPptxAction, isUrlSafe, buildSmartArtPresetData, classifyMediaType, computeSnapToShape, publishLiveGeometry, getDraggedShapeAdjustments, computeMarqueeHitIds, mergeAdditiveSelection, clampGifDimensions, rasterizeElement, shouldConfirmExternalHyperlink, applyResize, lockResizeAspect, snapBoxToGrid, applyMotionPathPreset, bringForward, sendBackward, bringToFront, sendToBack } from './chunk-MWNB4BX5.mjs';
|
|
1
|
+
import { DEFAULT_STROKE_COLOR, getConnectorPathGeometry, buildLineShadowCss, buildLineGlowFilter, renderConnectorMarker, getShapeVisualStyle, getTextStyleForElement, DEFAULT_TEXT_COLOR, renderVectorShape, isConnectorOrLineElement, build3DExtrusionData, getImageRenderStyle, cn, getImageSurfaceStyle, getTextLayoutStyle, renderTableElement, renderMediaElement, shouldRenderFallbackLabel, DEFAULT_FILL_COLOR, getCropShapeClipPath, hasDagDuotoneEffect, renderDagDuotoneSvgFilter, getImageSurfaceMaskStyle, getImageTilingStyle, getDuotoneColors, getTextWarpStyle, renderTextSegments, buildReactChartViewModel, renderChartElement, MIN_ELEMENT_SIZE, buildTextBody3DSceneStyle, DEFAULT_TEXT_FONT_SIZE, DEFAULT_FONT_FAMILY, HYPERLINK_COLOR, cloneHistorySnapshot, ZOOM_TO_SELECTION_PADDING, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, UNGROUPED_SECTION_ID, DEFAULT_SECTION_GROUP_ID, DEFAULT_TABLE_ROWS, DEFAULT_TABLE_COLUMNS, buildPdfFromTiledImageData, buildNotesPdf, GRID_SIZE } from './chunk-GITM3RKP.mjs';
|
|
2
|
+
import { GlyphOutlineFontCache, createGlyphOutlineLookup, DEFAULT_VIEWER_OPTIONS, TOOLBAR_TABS, getSelectionControlArtworkStyle, hasShapeProperties, normalizeHexColor, colorWithOpacity, normalizeStrokeDashType, getSvgStrokeDasharray, getCompoundLineOffsets, getCompoundLineWidths, svgLineCap, hasTextProperties, getSelectionOutlineColor, connectorWrapperTransform, getAriaRoleDescription, getAriaLabel, getAriaRole, resolveElementInteractivity, isEditableTextElement, buildTextStyleOverrideCss, isElementRendered, resolveElementAriaAttributes, shouldRenderHitTarget, elementHitTargetStyle, getImageEffectsOpacity, getImageEffectsFilter, inlineElementPointerEvents, isHollowShapeElement, LINK_TOOLTIP_HOST_CLASS, ACTION_BUTTON_PRESETS, mediaTransportVisible, isInkElement, getGroupChildParentFill, getElementLabel, getResizeHandleHitAreaStyle, paintedStrokeWidth, buildCssGradientFromShapeStyle, ensureActionAffordanceStyles, resolveElementActionAffordance, actionAffordanceLabels, paintedElementSize, getElementTransform, resolveElementHighlightClick, applyHighlightClickStyle, getComputedEffectStyle, getSoftEdgeSvgFilter, getEffectStyleSource, getBevelLightingSvgFilter, buildStrokeOutline, buildHollowHitOutline, buildSubpathFillOverlay, isImageLikeElement, strokeOutlineViewBox, resolveRevealedSmartArtNodes, resolveRevealedDrawingShapes, buildSmartArtA11y, canDrillDown, computeSmartArtElementLayout, flattenNodes, buildSummaryZoomView, isImageTiled, getImageColorWashStyle, readEditableText, placeCaretAtEnd, getPendingSelectionRestore, restoreSegmentSelection, getTextCompensationTransform, resolveChartKind, subscribeBarFacePicturePixelSamples, getBarFacePicturePixelSampleVersion, ensureChartInteractionStyles, applyChartPartHighlight, resolveRevealedChartData, formatAxisValue, buildInkGroupStrokes, getInkReplayStyles, INK_REPLAY_KEYFRAMES, buildContentPartStrokes, getContentPartReplayStyles, resolveOleType, getOleAriaLabel, getOleTypeColor, getOleTypeLabel, filterRenderedElements, resolveGroupChildFill, isLinkedTextBox, getOverflowSegments, shouldUseSvgWarp, getTextBodyRotationTransform, placeholderPromptDescriptor, 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, DEFAULT_PALETTE2, resolvePalette, computeDrawingViewBox, projectDrawingShapes, resolveRevealedDrawingShapeNodeIds, styleShadowFilter, buildChromeStyle, measureSvgViewportRect, modelDataToBlobUrl, getImageSvgFilters, buildDuotoneCacheKey, getDuotoneCachedResult, applyDuotone, setDuotoneCachedResult, buildCacheKey, DEFAULT_COLOR_CHANGE_TOLERANCE, getCachedResult, applyColorChange, setCachedResult, inlineListBodyText, createInlineListSeed, readListActivationSelection, createInlineListModelObserver, bindInlineListParagraph, bindInlineListRun, attachInlineListController, restoreInlineListBodySelection, getInlineEditorSelectionResult, isBulletMarkerSegment, findChartPartTarget, buildSurfaceChart3DDataForElement, buildBarChart3DDataForElement, buildLineChart3DDataForElement, buildAreaChart3DDataForElement, buildPieChart3DDataForElement, withChartTitle, buildSmartArt3DModel, collectCoherent3DOffNodeIds, isBrowserOpenableMime, formatBytes, getOleDisplayName, getOleBadgeLabel, openUrlInNewTab, getSubstituteFontFamily, hasGlyphEnvelope, buildGlyphEnvelope, getWarpPath, isWedgeCalloutPresetShape, isElementActionable, centeredSvgTextLines, findSmartArtNodeText, setSmartArtNodeStyle, rebuildDrawingShapesIfCleared, shouldCommitSmartArtNodeText, updateSmartArtNodeText, advanceChartMarkDrag, advanceChartValueDrag, buildChartMarkDragGeometry, beginChartMarkDrag, beginChartValueDrag, groupIntoParagraphs, substituteFieldText, computeInlineEditorRect, withChartPointValue, MIN_TOUCH_TARGET_PX, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, createSyncGate, clearLocalAwareness, validateRoomId, createDepartureChannel, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, registerCollaborationTeardown, createPresenceProjector, BROADCAST_THROTTLE_MS, sanitizeColor, cloneTemplateElementsBySlideId, cloneSlide, createWheelStepBuffer, createViewerZoomStore, clampZoomScale, mapEditingWheel, createActiveAnimationGroup, cancelBuildReveal, clearPlaybackTimers, PresentationAnimationController, resolveMediaTimeNodeElementIds, advanceMainSequence, playGroup, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, clearAudienceContent, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, storeAudienceContent, isPresentationSessionMessage, endAudienceDisplay, createPresentationKeyBuffer, acceptsPresentationInput, resolveAutoAdvanceDelayMs, hasShowSlideAfter, nextShowSlideIndex, previousShowSlideIndex, createPresenterShowGuard, firstShowSlideIndex, attachPresentationVisibilityPause, presentationEntrySlideIndex, buildMorphTransitionPlan, morphOptionToMode, buildMorphAnimationRules, findInSlides, applyFindReplacements, visibleTemplateElements, createCollaborationLivePatcher, publishLiveInlineText, PptxHandler, createPresentationLoadResources, collectMediaElements, resolveMediaElementSource, collectImagePaths, applyImagePathPatches, resolveTableCellImageUrls, resolveTableStyleImageUrls, partitionTemplateElements, seedRecentColors, resolveAuthoredCustomShowId, buildInitialGuides, readOnlyRecommendation, compatibilityWarningToasts, EncryptedFileError, resolveAutosaveIntervalMs, shouldWriteAutosaveSnapshot, saveAutosaveSnapshot, autosaveSnapshotMark, updateMasterViewElement, isTemplateElementId, updateElement, masterViewElements, replaceMasterViewElements, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, canInteractWithElement, prepareExportClone, normalizeColorsForCapture, preprocessCssForCapture, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, resolveImageResolutionScale, applyThemeToData, THEME_PRESETS, themeColorSchemesEqual, comparePresentation, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, describeFontEmbedding, isMobileViewport, resolveAuthoredSlideRange, mayLeaveSlideShow, stopAllPersistentAudio, guidePxToEmu, buildSaveSlides, buildDeckSaveOptions, resolveSlideSizeSelection, saveDeckWithPassword, shouldProbeAutosaveRecovery, probeAutosaveRecovery, acceptAutosaveRecovery, discardAutosaveRecovery, shouldLoopContinuously, applyRehearsalTimings, copyFormatFromElement, applyFormatToElement, collectReferencedFontFamilies, resolveGoogleWebfontHref, syncGoogleWebfontStylesheet, selectGoogleWebfontFamilies, fetchGoogleWebfontOutlineBytes, mapSlideShowStartKey, mapEditorKey, isEditorTextInputTarget, prepareElementForInsertion, createViewerOptionsStore, observeYDocSlides, LOCAL_SYNC_ORIGIN, readSlidesFromYDoc, shouldRoomSlidesReplaceLoad, reconcileSlidesInYDoc, shouldAutoFollowBroadcaster, detectTouchDevice, detectOrientation, deriveViewportBreakpoints, createTouchGestureRecognizer, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, isKeyboardOpen, scopeLayoutOptionsToSlide, checkModifyPassword, viewerPreferencesFromViewProperties, DEFAULT_VIEWER_PREFERENCES, viewPropertiesPatchFromPreferences, openPptxFile, readBackstageRecentFile, MORPH_CROSSFADE_GROUP_STYLE, MORPH_CROSSFADE_HALF_STYLE, getSlideTransitionAnimations, getFragmentedTransitionDescriptor, SLIDE_TRANSITION_KEYFRAMES, isActionHidden, buildInlineTextCommitPatch, resolveInlineEditAutoFitHeight, resolveInlineEditNormAutofitShrink, filterInteractableIds, beginShapeAdjustment, buildElementClipboardPayload, savedPresentationFileName, downloadBlob, exportDeckJson, groupElements, generateElementId, makeCloneId, ungroupElements, alignElements, distributeElements, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, mergeShapes, mapPresentationKey, lastShowSlideIndex, mapPresentationWheel, openPendingPrintWindow, computeColorFilter, filterHiddenSlideIndices, computeSlideIndices, buildPrintDocument, finishPrintWindow, buildPrintHtmlDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, makeSlideId, buildSlideTemplateSlide, templateSchemeFromTheme, buildThemeColorMap, reResolveSlideColors, reResolveElementColors, resolveViewportFitOptions, calculateViewportFit, scheduleAutoAdvanceChain, computeEntranceAnimationDelay, createPresentationSessionId, resolveTransitionDurationMs, resolveTransitionSoundAction, runPresentationAction, safeOpenUrl, buildRunProgramNotice, toggleStageElementMedia, resolveOleVerbTarget, downloadDataUrl, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, resetPresenterTimer, presenterElapsed, stepPresenterZoom, togglePresenterTimer, addCommentToList, removeCommentFromList, editCommentInList, toggleCommentResolvedInList, remapTextToSegments, buildInlineListStylePatch, applyActiveInlineListFormatting, applyListStyleUpdate, setPendingSelectionRestore, applyTextStyleUpdate, toggleSelectionBullets, transformInlineListCase, applyCaseTransformToSegments, transformTextCase, resolveExportCaptureDecision, recordProgressPercent, computeGridSpacingPx, resolveShowSlideIndexes, groupSlidesBySection, masterViewPseudoSlide, overlayMasterViewInlineSnapshot, overlayInlineTextSnapshot, cloneElementUpdates, assertElementUpdateTarget, prepareElementUpdateBatch, createWriteBackScheduler, observeExternalCollaborationReadiness, resolveHistoryDepth, hasCopyableFormat, createBackstagePresentation, buildFieldSubstitutionContext, cloneElementForPaste, computeScrollDelta, getPresetShapeClipPath, svgPathToPolygons, polygonsToSvgPath, rerouteConnectorsForMovedElements, applyReroutedConnectors, SvgExporter, replyToCommentInList, removeTableElementColumn, insertTableElementColumn, removeTableElementRow, insertTableElementRow, updateCellTextStyleInRawXml, setCellText, updateCellTextInRawXml, splitCell, updateMergeAttrsInRawXml, mergeCells, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, stopCaptureStream, GIF_POST_CAPTURE_MAX_SIDE, encodeGif, rasterResultToPngBlob, rasterizeElementTiles, placeTileOnPage, PDF_SLIDES_PAGE_WIDTH_PT, PDF_SLIDES_PAGE_HEIGHT_PT, canvasToJpegData, rasterizeElementTiledToCanvas, isPpactionUrl, parsePpactionUrl, resolvePresentationAction, elementActionToPptxAction, isUrlSafe, buildSmartArtPresetData, classifyMediaType, computeSnapToShape, publishLiveGeometry, getDraggedShapeAdjustments, computeMarqueeHitIds, mergeAdditiveSelection, borrowExternalCollaborationAwareness, observeExternalCollaborationSession, clampGifDimensions, rasterizeElement, shouldConfirmExternalHyperlink, applyResize, lockResizeAspect, snapBoxToGrid, applyMotionPathPreset, bringForward, sendBackward, bringToFront, sendToBack } from './chunk-33YE6E2O.mjs';
|
|
3
3
|
import { translationsEn } from './chunk-R664EPDC.mjs';
|
|
4
4
|
import React18, { createContext, useMemo, useState, useCallback, useEffect, Suspense, useRef, useLayoutEffect, useContext, useSyncExternalStore, useImperativeHandle } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
@@ -69,129 +69,15 @@ function useVirtualizedSlides({
|
|
|
69
69
|
scrollToIndex
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
localClientId,
|
|
75
|
-
userName,
|
|
76
|
-
userColor,
|
|
77
|
-
userAvatar,
|
|
78
|
-
role,
|
|
79
|
-
canvasWidth,
|
|
80
|
-
canvasHeight
|
|
81
|
-
}) {
|
|
82
|
-
const [remoteUsers, setRemoteUsers] = useState([]);
|
|
83
|
-
const projectorRef = useRef(null);
|
|
84
|
-
projectorRef.current ??= createPresenceProjector();
|
|
85
|
-
const projector = projectorRef.current;
|
|
86
|
-
const lastBroadcastRef = useRef(0);
|
|
87
|
-
const pendingBroadcastRef = useRef(null);
|
|
88
|
-
const latestLocalState = useRef({});
|
|
89
|
-
const broadcastPresence = useCallback(
|
|
90
|
-
(update) => {
|
|
91
|
-
if (!awareness) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
Object.assign(latestLocalState.current, update);
|
|
95
|
-
const now = Date.now();
|
|
96
|
-
const elapsed = now - lastBroadcastRef.current;
|
|
97
|
-
const flush = () => {
|
|
98
|
-
const state = {
|
|
99
|
-
...latestLocalState.current,
|
|
100
|
-
userName,
|
|
101
|
-
userColor,
|
|
102
|
-
userAvatar,
|
|
103
|
-
role,
|
|
104
|
-
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
105
|
-
};
|
|
106
|
-
awareness.setLocalStateField("presence", state);
|
|
107
|
-
lastBroadcastRef.current = Date.now();
|
|
108
|
-
};
|
|
109
|
-
if (elapsed >= BROADCAST_THROTTLE_MS) {
|
|
110
|
-
if (pendingBroadcastRef.current) {
|
|
111
|
-
clearTimeout(pendingBroadcastRef.current);
|
|
112
|
-
pendingBroadcastRef.current = null;
|
|
113
|
-
}
|
|
114
|
-
flush();
|
|
115
|
-
} else if (!pendingBroadcastRef.current) {
|
|
116
|
-
pendingBroadcastRef.current = setTimeout(() => {
|
|
117
|
-
pendingBroadcastRef.current = null;
|
|
118
|
-
flush();
|
|
119
|
-
}, BROADCAST_THROTTLE_MS - elapsed);
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
[awareness, userName, userColor, userAvatar, role]
|
|
123
|
-
);
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
if (!awareness) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
awareness.setLocalStateField("presence", {
|
|
129
|
-
userName,
|
|
130
|
-
userColor,
|
|
131
|
-
userAvatar,
|
|
132
|
-
role,
|
|
133
|
-
activeSlideIndex: 0,
|
|
134
|
-
cursorX: 0,
|
|
135
|
-
cursorY: 0,
|
|
136
|
-
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
137
|
-
});
|
|
138
|
-
}, [awareness, userName, userColor, userAvatar, role]);
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
if (!awareness || localClientId === null) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const handleChange = () => {
|
|
144
|
-
const { list, changed } = projector.project(
|
|
145
|
-
awareness.getStates(),
|
|
146
|
-
localClientId,
|
|
147
|
-
canvasWidth,
|
|
148
|
-
canvasHeight
|
|
149
|
-
);
|
|
150
|
-
if (!changed) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
setRemoteUsers(list);
|
|
154
|
-
};
|
|
155
|
-
awareness.on("change", handleChange);
|
|
156
|
-
awareness.on("update", handleChange);
|
|
157
|
-
handleChange();
|
|
158
|
-
return () => {
|
|
159
|
-
awareness.off("change", handleChange);
|
|
160
|
-
awareness.off("update", handleChange);
|
|
161
|
-
};
|
|
162
|
-
}, [awareness, localClientId, canvasWidth, canvasHeight, projector]);
|
|
163
|
-
useEffect(() => {
|
|
164
|
-
if (!awareness) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const interval = setInterval(() => {
|
|
168
|
-
awareness.setLocalStateField("presence", {
|
|
169
|
-
...latestLocalState.current,
|
|
170
|
-
userName,
|
|
171
|
-
userColor,
|
|
172
|
-
userAvatar,
|
|
173
|
-
role,
|
|
174
|
-
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
175
|
-
});
|
|
176
|
-
}, 1e4);
|
|
177
|
-
return () => clearInterval(interval);
|
|
178
|
-
}, [awareness, userName, userColor, userAvatar, role]);
|
|
179
|
-
useEffect(() => {
|
|
180
|
-
return () => {
|
|
181
|
-
if (pendingBroadcastRef.current) {
|
|
182
|
-
clearTimeout(pendingBroadcastRef.current);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
}, []);
|
|
186
|
-
return { remoteUsers, broadcastPresence };
|
|
187
|
-
}
|
|
188
|
-
function useYjsProvider({ config }) {
|
|
72
|
+
function useYjsProvider({ config: inputConfig }) {
|
|
73
|
+
const config = inputConfig?.externalSession ? void 0 : inputConfig;
|
|
189
74
|
const [status, setStatus] = useState("disconnected");
|
|
190
75
|
const [awareness, setAwareness] = useState(null);
|
|
191
76
|
const [doc, setDoc] = useState(null);
|
|
192
77
|
const [clientId, setClientId] = useState(null);
|
|
193
78
|
const [synced, setSynced] = useState(false);
|
|
194
79
|
const cleanupRef = useRef(null);
|
|
80
|
+
const generationRef = useRef(0);
|
|
195
81
|
const timeoutRef = useRef(null);
|
|
196
82
|
const departureRef = useRef(null);
|
|
197
83
|
const gateRef = useRef(null);
|
|
@@ -199,6 +85,7 @@ function useYjsProvider({ config }) {
|
|
|
199
85
|
gateRef.current = createSyncGate(() => setSynced(true));
|
|
200
86
|
}
|
|
201
87
|
const teardown = useCallback(() => {
|
|
88
|
+
generationRef.current += 1;
|
|
202
89
|
if (timeoutRef.current) {
|
|
203
90
|
clearTimeout(timeoutRef.current);
|
|
204
91
|
timeoutRef.current = null;
|
|
@@ -227,12 +114,16 @@ function useYjsProvider({ config }) {
|
|
|
227
114
|
[announceDeparture]
|
|
228
115
|
);
|
|
229
116
|
const initWebrtc = useCallback(async () => {
|
|
117
|
+
const generation = generationRef.current;
|
|
230
118
|
if (!config) {
|
|
231
119
|
return;
|
|
232
120
|
}
|
|
233
121
|
setStatus("connecting");
|
|
234
122
|
try {
|
|
235
|
-
const [Y, { WebrtcProvider }] = await Promise.all([import('
|
|
123
|
+
const [Y, { WebrtcProvider }] = await Promise.all([import('yjs'), import('./y-webrtc-XJDH2YTR.mjs')]);
|
|
124
|
+
if (generation !== generationRef.current) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
236
127
|
const yDoc = new Y.Doc();
|
|
237
128
|
const opts = {};
|
|
238
129
|
if (config.signaling && config.signaling.length > 0) {
|
|
@@ -273,6 +164,9 @@ function useYjsProvider({ config }) {
|
|
|
273
164
|
baseCleanup();
|
|
274
165
|
};
|
|
275
166
|
} catch (err) {
|
|
167
|
+
if (generation !== generationRef.current) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
276
170
|
console.warn(
|
|
277
171
|
"[pptx-viewer] WebRTC collaboration packages not available:",
|
|
278
172
|
err instanceof Error ? err.message : err
|
|
@@ -282,6 +176,7 @@ function useYjsProvider({ config }) {
|
|
|
282
176
|
}, [config?.roomId, config?.authToken, config?.signaling, buildCleanup]);
|
|
283
177
|
const init = useCallback(async () => {
|
|
284
178
|
teardown();
|
|
179
|
+
const generation = generationRef.current;
|
|
285
180
|
if (!config) {
|
|
286
181
|
return;
|
|
287
182
|
}
|
|
@@ -300,7 +195,10 @@ function useYjsProvider({ config }) {
|
|
|
300
195
|
}
|
|
301
196
|
setStatus("connecting");
|
|
302
197
|
try {
|
|
303
|
-
const [Y, { WebsocketProvider }] = await Promise.all([import('
|
|
198
|
+
const [Y, { WebsocketProvider }] = await Promise.all([import('yjs'), import('./y-websocket-SJ3NCLBZ.mjs')]);
|
|
199
|
+
if (generation !== generationRef.current) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
304
202
|
const yDoc = new Y.Doc();
|
|
305
203
|
const provider = new WebsocketProvider(config.serverUrl, roomId, yDoc, {
|
|
306
204
|
params: config.authToken ? { token: config.authToken } : void 0
|
|
@@ -372,6 +270,9 @@ function useYjsProvider({ config }) {
|
|
|
372
270
|
setStatus("disconnected");
|
|
373
271
|
};
|
|
374
272
|
} catch (err) {
|
|
273
|
+
if (generation !== generationRef.current) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
375
276
|
console.warn(
|
|
376
277
|
"[pptx-viewer] Collaboration packages not available:",
|
|
377
278
|
err instanceof Error ? err.message : err
|
|
@@ -403,6 +304,189 @@ function useYjsProvider({ config }) {
|
|
|
403
304
|
}, [init]);
|
|
404
305
|
return { status, awareness, doc, clientId, synced, retry };
|
|
405
306
|
}
|
|
307
|
+
function usePresenceTracking({
|
|
308
|
+
awareness,
|
|
309
|
+
localClientId,
|
|
310
|
+
userName,
|
|
311
|
+
userColor,
|
|
312
|
+
userAvatar,
|
|
313
|
+
role,
|
|
314
|
+
canvasWidth,
|
|
315
|
+
canvasHeight
|
|
316
|
+
}) {
|
|
317
|
+
const [remoteUsers, setRemoteUsers] = useState([]);
|
|
318
|
+
const projectorRef = useRef(null);
|
|
319
|
+
projectorRef.current ??= createPresenceProjector();
|
|
320
|
+
const projector = projectorRef.current;
|
|
321
|
+
const lastBroadcastRef = useRef(0);
|
|
322
|
+
const pendingBroadcastRef = useRef(null);
|
|
323
|
+
const latestLocalState = useRef({});
|
|
324
|
+
const broadcastPresence = useCallback(
|
|
325
|
+
(update) => {
|
|
326
|
+
if (!awareness) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
Object.assign(latestLocalState.current, update);
|
|
330
|
+
const now = Date.now();
|
|
331
|
+
const elapsed = now - lastBroadcastRef.current;
|
|
332
|
+
const flush = () => {
|
|
333
|
+
const state = {
|
|
334
|
+
...latestLocalState.current,
|
|
335
|
+
userName,
|
|
336
|
+
userColor,
|
|
337
|
+
userAvatar,
|
|
338
|
+
role,
|
|
339
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
340
|
+
};
|
|
341
|
+
awareness.setLocalStateField("presence", state);
|
|
342
|
+
lastBroadcastRef.current = Date.now();
|
|
343
|
+
};
|
|
344
|
+
if (elapsed >= BROADCAST_THROTTLE_MS) {
|
|
345
|
+
if (pendingBroadcastRef.current) {
|
|
346
|
+
clearTimeout(pendingBroadcastRef.current);
|
|
347
|
+
pendingBroadcastRef.current = null;
|
|
348
|
+
}
|
|
349
|
+
flush();
|
|
350
|
+
} else if (!pendingBroadcastRef.current) {
|
|
351
|
+
pendingBroadcastRef.current = setTimeout(() => {
|
|
352
|
+
pendingBroadcastRef.current = null;
|
|
353
|
+
flush();
|
|
354
|
+
}, BROADCAST_THROTTLE_MS - elapsed);
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
[awareness, userName, userColor, userAvatar, role]
|
|
358
|
+
);
|
|
359
|
+
useEffect(() => {
|
|
360
|
+
if (!awareness) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
awareness.setLocalStateField("presence", {
|
|
364
|
+
userName,
|
|
365
|
+
userColor,
|
|
366
|
+
userAvatar,
|
|
367
|
+
role,
|
|
368
|
+
activeSlideIndex: 0,
|
|
369
|
+
cursorX: 0,
|
|
370
|
+
cursorY: 0,
|
|
371
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
372
|
+
});
|
|
373
|
+
}, [awareness, userName, userColor, userAvatar, role]);
|
|
374
|
+
useEffect(() => {
|
|
375
|
+
if (!awareness || localClientId === null) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
const handleChange = () => {
|
|
379
|
+
const { list, changed } = projector.project(
|
|
380
|
+
awareness.getStates(),
|
|
381
|
+
localClientId,
|
|
382
|
+
canvasWidth,
|
|
383
|
+
canvasHeight
|
|
384
|
+
);
|
|
385
|
+
if (!changed) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
setRemoteUsers(list);
|
|
389
|
+
};
|
|
390
|
+
awareness.on("change", handleChange);
|
|
391
|
+
awareness.on("update", handleChange);
|
|
392
|
+
handleChange();
|
|
393
|
+
return () => {
|
|
394
|
+
awareness.off("change", handleChange);
|
|
395
|
+
awareness.off("update", handleChange);
|
|
396
|
+
};
|
|
397
|
+
}, [awareness, localClientId, canvasWidth, canvasHeight, projector]);
|
|
398
|
+
useEffect(() => {
|
|
399
|
+
if (!awareness) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
const interval = setInterval(() => {
|
|
403
|
+
awareness.setLocalStateField("presence", {
|
|
404
|
+
...latestLocalState.current,
|
|
405
|
+
userName,
|
|
406
|
+
userColor,
|
|
407
|
+
userAvatar,
|
|
408
|
+
role,
|
|
409
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
410
|
+
});
|
|
411
|
+
}, 1e4);
|
|
412
|
+
return () => clearInterval(interval);
|
|
413
|
+
}, [awareness, userName, userColor, userAvatar, role]);
|
|
414
|
+
useEffect(() => {
|
|
415
|
+
return () => {
|
|
416
|
+
if (pendingBroadcastRef.current) {
|
|
417
|
+
clearTimeout(pendingBroadcastRef.current);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
}, []);
|
|
421
|
+
return { remoteUsers, broadcastPresence };
|
|
422
|
+
}
|
|
423
|
+
var inactive = {
|
|
424
|
+
status: "disconnected",
|
|
425
|
+
awareness: null,
|
|
426
|
+
doc: null,
|
|
427
|
+
clientId: null,
|
|
428
|
+
synced: false,
|
|
429
|
+
// An external transport can only be retried by its owner.
|
|
430
|
+
retry: () => {
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
function useExternalYjsSession(session) {
|
|
434
|
+
const [binding, setBinding] = useState(null);
|
|
435
|
+
useEffect(() => {
|
|
436
|
+
if (!session) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
let detach;
|
|
440
|
+
const leave = () => {
|
|
441
|
+
detach?.();
|
|
442
|
+
detach = void 0;
|
|
443
|
+
setBinding(null);
|
|
444
|
+
};
|
|
445
|
+
const attach = () => {
|
|
446
|
+
leave();
|
|
447
|
+
const borrowed = borrowExternalCollaborationAwareness(session.awareness);
|
|
448
|
+
try {
|
|
449
|
+
const unsubscribe = observeExternalCollaborationSession(session, (snapshot) => {
|
|
450
|
+
setBinding({
|
|
451
|
+
session,
|
|
452
|
+
value: {
|
|
453
|
+
...snapshot,
|
|
454
|
+
doc: session.doc,
|
|
455
|
+
awareness: borrowed.awareness,
|
|
456
|
+
clientId: session.awareness.clientID,
|
|
457
|
+
retry: inactive.retry
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
detach = () => {
|
|
462
|
+
unsubscribe();
|
|
463
|
+
borrowed.dispose();
|
|
464
|
+
};
|
|
465
|
+
} catch {
|
|
466
|
+
borrowed.dispose();
|
|
467
|
+
setBinding({ session, value: { ...inactive, status: "error" } });
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
attach();
|
|
471
|
+
const unregister = registerCollaborationTeardown({
|
|
472
|
+
leave,
|
|
473
|
+
rejoin: attach,
|
|
474
|
+
leaveOnBeforeUnload: false
|
|
475
|
+
});
|
|
476
|
+
return () => {
|
|
477
|
+
unregister();
|
|
478
|
+
leave();
|
|
479
|
+
};
|
|
480
|
+
}, [session]);
|
|
481
|
+
return binding && binding.session === session ? binding.value : inactive;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// src/viewer/hooks/collaboration/useCollaborationSession.ts
|
|
485
|
+
function useCollaborationSession({ config }) {
|
|
486
|
+
const owned = useYjsProvider({ config: config?.externalSession ? void 0 : config });
|
|
487
|
+
const external = useExternalYjsSession(config?.externalSession);
|
|
488
|
+
return config?.externalSession ? external : owned;
|
|
489
|
+
}
|
|
406
490
|
|
|
407
491
|
// src/viewer/hooks/collaboration/useCollaborativeState.ts
|
|
408
492
|
function useCollaborativeState({
|
|
@@ -411,7 +495,7 @@ function useCollaborativeState({
|
|
|
411
495
|
canvasHeight
|
|
412
496
|
}) {
|
|
413
497
|
const userColor = sanitizeColor(config?.userColor, "#6366f1");
|
|
414
|
-
const { status, awareness, doc, clientId, synced, retry } =
|
|
498
|
+
const { status, awareness, doc, clientId, synced, retry } = useCollaborationSession({ config });
|
|
415
499
|
const { remoteUsers, broadcastPresence } = usePresenceTracking({
|
|
416
500
|
awareness,
|
|
417
501
|
localClientId: clientId,
|
|
@@ -5493,6 +5577,15 @@ function useCanvasInteractions(input) {
|
|
|
5493
5577
|
setInlineEditingElementId(null);
|
|
5494
5578
|
setInlineEditingText("");
|
|
5495
5579
|
};
|
|
5580
|
+
const latestCommit = useRef(handleInlineEditCommit);
|
|
5581
|
+
latestCommit.current = handleInlineEditCommit;
|
|
5582
|
+
const wasEditable = useRef(canEdit);
|
|
5583
|
+
useLayoutEffect(() => {
|
|
5584
|
+
if (wasEditable.current && !canEdit) {
|
|
5585
|
+
latestCommit.current();
|
|
5586
|
+
}
|
|
5587
|
+
wasEditable.current = canEdit;
|
|
5588
|
+
}, [canEdit]);
|
|
5496
5589
|
const openEquationEditorForElement = (el) => {
|
|
5497
5590
|
if (!hasTextProperties(el)) {
|
|
5498
5591
|
return false;
|
|
@@ -10867,157 +10960,250 @@ function useCollaborativeHistory({
|
|
|
10867
10960
|
canRedo
|
|
10868
10961
|
};
|
|
10869
10962
|
}
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10963
|
+
function useCollaborationWriteBack(input) {
|
|
10964
|
+
const latest = useRef(input);
|
|
10965
|
+
latest.current = input;
|
|
10966
|
+
const scheduler = useMemo(
|
|
10967
|
+
() => createWriteBackScheduler({
|
|
10968
|
+
getYDoc: () => latest.current.doc,
|
|
10969
|
+
getSourceBytes: () => latest.current.getSourceBytes?.() ?? null,
|
|
10970
|
+
getSaveOptions: () => latest.current.getSaveOptions?.(),
|
|
10971
|
+
getTemplateElements: () => latest.current.templateElementsBySlideId,
|
|
10972
|
+
mergeTemplateElements: buildSaveSlides
|
|
10973
|
+
}),
|
|
10974
|
+
[latest]
|
|
10975
|
+
);
|
|
10976
|
+
const hasWriteBack = Boolean(input.config?.onWriteBack);
|
|
10977
|
+
useEffect(
|
|
10978
|
+
() => () => scheduler.cancel(),
|
|
10979
|
+
[scheduler, input.doc, input.config?.role, hasWriteBack, input.config?.externalSession]
|
|
10980
|
+
);
|
|
10981
|
+
return useCallback(() => {
|
|
10982
|
+
const { config, doc } = latest.current;
|
|
10983
|
+
if (config) {
|
|
10984
|
+
const session = config.externalSession;
|
|
10985
|
+
scheduler.schedule({
|
|
10986
|
+
...config,
|
|
10987
|
+
// An inline host callback may change on an unrelated render.
|
|
10988
|
+
// Keep pending work, but deliver it through the current callback.
|
|
10989
|
+
onWriteBack: config.onWriteBack ? (bytes) => {
|
|
10990
|
+
const current = latest.current;
|
|
10991
|
+
if (current.doc === doc && current.config?.role === "owner" && current.config.externalSession === session) {
|
|
10992
|
+
current.config.onWriteBack?.(bytes);
|
|
10993
|
+
}
|
|
10994
|
+
} : void 0
|
|
10995
|
+
});
|
|
10996
|
+
}
|
|
10997
|
+
}, [scheduler, latest]);
|
|
10998
|
+
}
|
|
10999
|
+
function useExternalDocumentSync(input, scheduleWriteBack) {
|
|
11000
|
+
const latest = useRef(input);
|
|
11001
|
+
latest.current = input;
|
|
11002
|
+
const controller = useRef(null);
|
|
11003
|
+
const publish = useRef(() => {
|
|
11004
|
+
});
|
|
11005
|
+
const lastLoad = useRef(input.loadVersion ?? 0);
|
|
11006
|
+
const session = input.config?.externalSession;
|
|
11007
|
+
const role = input.config?.role;
|
|
11008
|
+
const intent = input.config?.sessionIntent;
|
|
11009
|
+
const { doc, isConnected, livePatcher } = input;
|
|
11010
|
+
useEffect(() => {
|
|
11011
|
+
if (!session || !doc || !isConnected) {
|
|
11012
|
+
return;
|
|
11013
|
+
}
|
|
11014
|
+
latest.current.onReadOnlyChange?.(true);
|
|
11015
|
+
let active = true;
|
|
11016
|
+
let revision = 0;
|
|
11017
|
+
let lastSynced = "";
|
|
11018
|
+
let superseded = null;
|
|
11019
|
+
const initialLoad = latest.current.loadVersion ?? 0;
|
|
11020
|
+
const gate = createSyncGate(() => {
|
|
11021
|
+
});
|
|
11022
|
+
const adopt = (slides) => {
|
|
11023
|
+
revision++;
|
|
11024
|
+
lastSynced = JSON.stringify(slides);
|
|
11025
|
+
superseded = latest.current.slides;
|
|
11026
|
+
latest.current.setSlides(slides);
|
|
11027
|
+
scheduleWriteBack();
|
|
10899
11028
|
};
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
11029
|
+
void (async () => {
|
|
11030
|
+
const Y = await import('yjs');
|
|
11031
|
+
if (!active) {
|
|
11032
|
+
return;
|
|
11033
|
+
}
|
|
11034
|
+
const factories = {
|
|
11035
|
+
createMap: () => new Y.Map(),
|
|
11036
|
+
createArray: () => new Y.Array(),
|
|
11037
|
+
createText: () => new Y.Text()
|
|
11038
|
+
};
|
|
11039
|
+
publish.current = (nextSlides) => {
|
|
11040
|
+
const slides = nextSlides ?? latest.current.slides;
|
|
11041
|
+
const { loadVersion = 0 } = latest.current;
|
|
11042
|
+
const serialized = JSON.stringify(slides);
|
|
11043
|
+
const token = revision;
|
|
11044
|
+
queueMicrotask(() => {
|
|
11045
|
+
if (!active || !controller.current?.canWrite() || token !== revision || slides === superseded || loadVersion !== lastLoad.current || serialized === lastSynced) {
|
|
11046
|
+
return;
|
|
11047
|
+
}
|
|
11048
|
+
reconcileSlidesInYDoc(slides, doc, factories);
|
|
11049
|
+
lastSynced = serialized;
|
|
11050
|
+
scheduleWriteBack();
|
|
11051
|
+
});
|
|
11052
|
+
};
|
|
11053
|
+
controller.current = observeExternalCollaborationReadiness(session, {
|
|
11054
|
+
gate,
|
|
11055
|
+
factories,
|
|
11056
|
+
livePatcher,
|
|
11057
|
+
role,
|
|
11058
|
+
sessionIntent: intent,
|
|
11059
|
+
onStatus: () => {
|
|
11060
|
+
},
|
|
11061
|
+
adoptSlides: adopt,
|
|
11062
|
+
onSuspend: () => {
|
|
11063
|
+
revision++;
|
|
11064
|
+
},
|
|
11065
|
+
onReadOnlyChange: (readOnly) => latest.current.onReadOnlyChange?.(readOnly),
|
|
11066
|
+
onReady: ({ seedEmptyRoom }) => {
|
|
11067
|
+
if (seedEmptyRoom) {
|
|
11068
|
+
lastSynced = "";
|
|
11069
|
+
}
|
|
11070
|
+
publish.current();
|
|
11071
|
+
}
|
|
11072
|
+
});
|
|
11073
|
+
if ((latest.current.loadVersion ?? 0) !== initialLoad) {
|
|
11074
|
+
controller.current.handleLoad(latest.current.loadOrigin ?? "user");
|
|
11075
|
+
}
|
|
11076
|
+
})();
|
|
11077
|
+
return () => {
|
|
11078
|
+
active = false;
|
|
11079
|
+
revision++;
|
|
11080
|
+
controller.current?.();
|
|
11081
|
+
controller.current = null;
|
|
11082
|
+
publish.current = () => {
|
|
11083
|
+
};
|
|
11084
|
+
};
|
|
11085
|
+
}, [session, doc, isConnected, role, intent, livePatcher, scheduleWriteBack]);
|
|
11086
|
+
useEffect(() => {
|
|
11087
|
+
if (typeof input.isSynced === "boolean") {
|
|
11088
|
+
controller.current?.refresh();
|
|
11089
|
+
}
|
|
11090
|
+
}, [input.isSynced]);
|
|
11091
|
+
useEffect(() => {
|
|
11092
|
+
const version = input.loadVersion ?? 0;
|
|
11093
|
+
if (version !== lastLoad.current) {
|
|
11094
|
+
lastLoad.current = version;
|
|
11095
|
+
controller.current?.handleLoad(input.loadOrigin ?? "user");
|
|
11096
|
+
}
|
|
11097
|
+
publish.current(input.slides);
|
|
11098
|
+
}, [input.slides, input.loadVersion, input.loadOrigin]);
|
|
11099
|
+
}
|
|
11100
|
+
|
|
11101
|
+
// src/viewer/hooks/collaboration/useYjsDocumentSync.ts
|
|
11102
|
+
function useYjsDocumentSync(input) {
|
|
11103
|
+
const {
|
|
11104
|
+
doc,
|
|
11105
|
+
slides,
|
|
11106
|
+
setSlides,
|
|
11107
|
+
isConnected,
|
|
11108
|
+
isSynced = true,
|
|
11109
|
+
config,
|
|
11110
|
+
loadVersion = 0,
|
|
11111
|
+
loadOrigin = "user"
|
|
11112
|
+
} = input;
|
|
11113
|
+
const external = Boolean(config?.externalSession);
|
|
11114
|
+
const scheduleWriteBack = useCollaborationWriteBack(input);
|
|
11115
|
+
useExternalDocumentSync(input, scheduleWriteBack);
|
|
11116
|
+
const lastSynced = useRef("");
|
|
11117
|
+
const superseded = useRef(null);
|
|
11118
|
+
const latestSlides = useRef(slides);
|
|
11119
|
+
latestSlides.current = slides;
|
|
11120
|
+
const lastLoad = useRef(loadVersion);
|
|
11121
|
+
const revision = useRef(0);
|
|
11122
|
+
useEffect(() => {
|
|
11123
|
+
if (external || !doc) {
|
|
10905
11124
|
return;
|
|
10906
11125
|
}
|
|
10907
|
-
|
|
10908
|
-
|
|
11126
|
+
lastSynced.current = "";
|
|
11127
|
+
superseded.current = null;
|
|
11128
|
+
revision.current++;
|
|
11129
|
+
}, [doc, external]);
|
|
11130
|
+
useEffect(() => {
|
|
11131
|
+
if (external || !doc || !isConnected) {
|
|
11132
|
+
return;
|
|
10909
11133
|
}
|
|
10910
|
-
const
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
if (!doc || !config.onWriteBack) {
|
|
11134
|
+
const adopt = () => {
|
|
11135
|
+
const remote = readSlidesFromYDoc(doc);
|
|
11136
|
+
if (!remote.length) {
|
|
10914
11137
|
return;
|
|
10915
11138
|
}
|
|
10916
|
-
const
|
|
10917
|
-
if (
|
|
11139
|
+
const serialized = JSON.stringify(remote);
|
|
11140
|
+
if (serialized === lastSynced.current) {
|
|
10918
11141
|
return;
|
|
10919
11142
|
}
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
config.onWriteBack(bytes);
|
|
10929
|
-
} catch {
|
|
11143
|
+
lastSynced.current = serialized;
|
|
11144
|
+
superseded.current = latestSlides.current;
|
|
11145
|
+
revision.current++;
|
|
11146
|
+
setSlides(remote);
|
|
11147
|
+
};
|
|
11148
|
+
const unobserve = observeYDocSlides(doc, (_events, transaction) => {
|
|
11149
|
+
if (transaction?.origin === LOCAL_SYNC_ORIGIN) {
|
|
11150
|
+
return;
|
|
10930
11151
|
}
|
|
10931
|
-
|
|
10932
|
-
|
|
11152
|
+
adopt();
|
|
11153
|
+
scheduleWriteBack();
|
|
11154
|
+
});
|
|
11155
|
+
adopt();
|
|
11156
|
+
const revokeWrites = () => {
|
|
11157
|
+
revision.current++;
|
|
11158
|
+
};
|
|
11159
|
+
return () => {
|
|
11160
|
+
unobserve();
|
|
11161
|
+
revokeWrites();
|
|
11162
|
+
};
|
|
11163
|
+
}, [external, doc, isConnected, setSlides, scheduleWriteBack]);
|
|
10933
11164
|
useEffect(() => {
|
|
10934
|
-
if (loadVersion ===
|
|
11165
|
+
if (external || loadVersion === lastLoad.current) {
|
|
10935
11166
|
return;
|
|
10936
11167
|
}
|
|
10937
|
-
|
|
11168
|
+
lastLoad.current = loadVersion;
|
|
10938
11169
|
if (!doc || !isConnected) {
|
|
10939
11170
|
return;
|
|
10940
11171
|
}
|
|
10941
|
-
const
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
11172
|
+
const room = readSlidesFromYDoc(doc);
|
|
11173
|
+
if (shouldRoomSlidesReplaceLoad(loadOrigin, room.length)) {
|
|
11174
|
+
lastSynced.current = JSON.stringify(room);
|
|
11175
|
+
superseded.current = latestSlides.current;
|
|
11176
|
+
revision.current++;
|
|
11177
|
+
setSlides(room);
|
|
10946
11178
|
}
|
|
10947
|
-
|
|
10948
|
-
isApplyingRemoteRef.current = true;
|
|
10949
|
-
setSlides(docSlides);
|
|
10950
|
-
isApplyingRemoteRef.current = false;
|
|
10951
|
-
}, [loadVersion, loadOrigin, doc, isConnected, setSlides]);
|
|
11179
|
+
}, [external, loadVersion, loadOrigin, doc, isConnected, setSlides]);
|
|
10952
11180
|
useEffect(() => {
|
|
10953
|
-
if (!
|
|
11181
|
+
if (external || !doc || !isConnected || !isSynced || config?.role === "viewer" || !slides.length || slides === superseded.current) {
|
|
10954
11182
|
return;
|
|
10955
11183
|
}
|
|
10956
11184
|
const serialized = JSON.stringify(slides);
|
|
10957
|
-
if (serialized ===
|
|
11185
|
+
if (serialized === lastSynced.current) {
|
|
10958
11186
|
return;
|
|
10959
11187
|
}
|
|
10960
|
-
|
|
11188
|
+
let cancelled = false;
|
|
11189
|
+
const token = revision.current;
|
|
10961
11190
|
void (async () => {
|
|
10962
|
-
const
|
|
10963
|
-
|
|
10964
|
-
slides,
|
|
10965
|
-
doc,
|
|
10966
|
-
factories,
|
|
10967
|
-
LOCAL_SYNC_ORIGIN
|
|
10968
|
-
);
|
|
10969
|
-
scheduleWriteBack();
|
|
10970
|
-
})();
|
|
10971
|
-
}, [doc, slides, isConnected, isSynced, getFactories, scheduleWriteBack]);
|
|
10972
|
-
useEffect(() => {
|
|
10973
|
-
hasInitializedRef.current = false;
|
|
10974
|
-
lastSyncedRef.current = "";
|
|
10975
|
-
}, [doc]);
|
|
10976
|
-
useEffect(() => {
|
|
10977
|
-
if (!isConnected || !doc) {
|
|
10978
|
-
return;
|
|
10979
|
-
}
|
|
10980
|
-
const handleChange = (_events, transaction) => {
|
|
10981
|
-
if (transaction?.origin === LOCAL_SYNC_ORIGIN) {
|
|
11191
|
+
const Y = await import('yjs');
|
|
11192
|
+
if (cancelled || token !== revision.current || loadVersion !== lastLoad.current) {
|
|
10982
11193
|
return;
|
|
10983
11194
|
}
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
|
|
10990
|
-
const serialized = JSON.stringify(remoteSlides);
|
|
10991
|
-
if (serialized === lastSyncedRef.current) {
|
|
10992
|
-
return;
|
|
10993
|
-
}
|
|
10994
|
-
lastSyncedRef.current = serialized;
|
|
10995
|
-
isApplyingRemoteRef.current = true;
|
|
10996
|
-
setSlides(remoteSlides);
|
|
10997
|
-
isApplyingRemoteRef.current = false;
|
|
11195
|
+
reconcileSlidesInYDoc(slides, doc, {
|
|
11196
|
+
createMap: () => new Y.Map(),
|
|
11197
|
+
createArray: () => new Y.Array(),
|
|
11198
|
+
createText: () => new Y.Text()
|
|
11199
|
+
});
|
|
11200
|
+
lastSynced.current = serialized;
|
|
10998
11201
|
scheduleWriteBack();
|
|
10999
|
-
};
|
|
11000
|
-
const unobserve = observeYDocSlides(
|
|
11001
|
-
doc,
|
|
11002
|
-
handleChange
|
|
11003
|
-
);
|
|
11004
|
-
if (!hasInitializedRef.current) {
|
|
11005
|
-
hasInitializedRef.current = true;
|
|
11006
|
-
const arr = doc.getArray(
|
|
11007
|
-
"pptx:slides"
|
|
11008
|
-
);
|
|
11009
|
-
if (arr.length > 0) {
|
|
11010
|
-
handleChange();
|
|
11011
|
-
}
|
|
11012
|
-
}
|
|
11202
|
+
})();
|
|
11013
11203
|
return () => {
|
|
11014
|
-
|
|
11015
|
-
if (writeBackTimerRef.current !== null) {
|
|
11016
|
-
clearTimeout(writeBackTimerRef.current);
|
|
11017
|
-
writeBackTimerRef.current = null;
|
|
11018
|
-
}
|
|
11204
|
+
cancelled = true;
|
|
11019
11205
|
};
|
|
11020
|
-
}, [doc, isConnected,
|
|
11206
|
+
}, [external, doc, slides, isConnected, isSynced, config?.role, loadVersion, scheduleWriteBack]);
|
|
11021
11207
|
}
|
|
11022
11208
|
function useBroadcastFollower({
|
|
11023
11209
|
collab,
|
|
@@ -11098,31 +11284,40 @@ function useCollaborationLivePatch({
|
|
|
11098
11284
|
patcher,
|
|
11099
11285
|
doc,
|
|
11100
11286
|
isConnected,
|
|
11101
|
-
isSynced = true
|
|
11287
|
+
isSynced = true,
|
|
11288
|
+
externalSession
|
|
11102
11289
|
}) {
|
|
11103
11290
|
useEffect(() => {
|
|
11291
|
+
if (externalSession) {
|
|
11292
|
+
return;
|
|
11293
|
+
}
|
|
11104
11294
|
if (!doc || !isConnected || !isSynced) {
|
|
11105
11295
|
patcher.configure(null, null);
|
|
11106
11296
|
return;
|
|
11107
11297
|
}
|
|
11108
11298
|
let cancelled = false;
|
|
11299
|
+
let factories = null;
|
|
11300
|
+
const configure = () => {
|
|
11301
|
+
const ready = isSynced;
|
|
11302
|
+
patcher.configure(ready && factories ? doc : null, ready ? factories : null);
|
|
11303
|
+
};
|
|
11109
11304
|
void (async () => {
|
|
11110
|
-
const Y = await import('
|
|
11305
|
+
const Y = await import('yjs');
|
|
11111
11306
|
if (cancelled) {
|
|
11112
11307
|
return;
|
|
11113
11308
|
}
|
|
11114
|
-
|
|
11309
|
+
factories = {
|
|
11115
11310
|
createMap: () => new Y.Map(),
|
|
11116
11311
|
createArray: () => new Y.Array(),
|
|
11117
11312
|
createText: () => new Y.Text()
|
|
11118
11313
|
};
|
|
11119
|
-
|
|
11314
|
+
configure();
|
|
11120
11315
|
})();
|
|
11121
11316
|
return () => {
|
|
11122
11317
|
cancelled = true;
|
|
11123
11318
|
patcher.configure(null, null);
|
|
11124
11319
|
};
|
|
11125
|
-
}, [patcher, doc, isConnected, isSynced]);
|
|
11320
|
+
}, [patcher, doc, isConnected, isSynced, externalSession]);
|
|
11126
11321
|
}
|
|
11127
11322
|
function useLayoutSwitching(input) {
|
|
11128
11323
|
const { handler, slides, activeSlideIndex, ops, history, onTemplateElementsChanged } = input;
|
|
@@ -12773,7 +12968,7 @@ function FailedToLoad() {
|
|
|
12773
12968
|
var LazyArea3DChartScene = React18.lazy(
|
|
12774
12969
|
async () => {
|
|
12775
12970
|
try {
|
|
12776
|
-
return await import('./Area3DChartScene-
|
|
12971
|
+
return await import('./Area3DChartScene-LKOWSMAU.mjs');
|
|
12777
12972
|
} catch {
|
|
12778
12973
|
return { default: FailedToLoad };
|
|
12779
12974
|
}
|
|
@@ -12842,7 +13037,7 @@ function FailedToLoad2() {
|
|
|
12842
13037
|
var LazyBar3DChartScene = React18.lazy(
|
|
12843
13038
|
async () => {
|
|
12844
13039
|
try {
|
|
12845
|
-
return await import('./Bar3DChartScene-
|
|
13040
|
+
return await import('./Bar3DChartScene-NQNSIMUL.mjs');
|
|
12846
13041
|
} catch {
|
|
12847
13042
|
return { default: FailedToLoad2 };
|
|
12848
13043
|
}
|
|
@@ -12945,7 +13140,7 @@ function FailedToLoad3() {
|
|
|
12945
13140
|
var LazyLine3DChartScene = React18.lazy(
|
|
12946
13141
|
async () => {
|
|
12947
13142
|
try {
|
|
12948
|
-
return await import('./Line3DChartScene-
|
|
13143
|
+
return await import('./Line3DChartScene-ANZBJYQI.mjs');
|
|
12949
13144
|
} catch {
|
|
12950
13145
|
return { default: FailedToLoad3 };
|
|
12951
13146
|
}
|
|
@@ -13014,7 +13209,7 @@ function FailedToLoad4() {
|
|
|
13014
13209
|
var LazyPieChart3DScene = React18.lazy(
|
|
13015
13210
|
async () => {
|
|
13016
13211
|
try {
|
|
13017
|
-
return await import('./PieChart3DScene-
|
|
13212
|
+
return await import('./PieChart3DScene-FBRPLHLG.mjs');
|
|
13018
13213
|
} catch {
|
|
13019
13214
|
return { default: FailedToLoad4 };
|
|
13020
13215
|
}
|
|
@@ -13081,7 +13276,7 @@ function FailedToLoad5() {
|
|
|
13081
13276
|
var LazySurfaceChart3DScene = React18.lazy(
|
|
13082
13277
|
async () => {
|
|
13083
13278
|
try {
|
|
13084
|
-
return await import('./SurfaceChart3DScene-
|
|
13279
|
+
return await import('./SurfaceChart3DScene-7HE5DA3X.mjs');
|
|
13085
13280
|
} catch {
|
|
13086
13281
|
return { default: FailedToLoad5 };
|
|
13087
13282
|
}
|
|
@@ -14599,7 +14794,7 @@ var ElementRenderer = React18.memo(
|
|
|
14599
14794
|
);
|
|
14600
14795
|
}
|
|
14601
14796
|
const effectiveCanInteract = canInteract && allow.selectable;
|
|
14602
|
-
const effectiveIsInlineEditing = isInlineEditing && allow.textEditable;
|
|
14797
|
+
const effectiveIsInlineEditing = isInlineEditing && canInteract && allow.textEditable;
|
|
14603
14798
|
const canEditSmartArt = effectiveCanInteract && allow.textEditable;
|
|
14604
14799
|
const canEditChart = effectiveCanInteract;
|
|
14605
14800
|
const hasAction = Boolean(el.actionClick && onActionClick);
|
|
@@ -15484,7 +15679,7 @@ function FailedToLoad6() {
|
|
|
15484
15679
|
var LazyModel3DScene = React18.lazy(
|
|
15485
15680
|
async () => {
|
|
15486
15681
|
try {
|
|
15487
|
-
return await import('./Model3DScene-
|
|
15682
|
+
return await import('./Model3DScene-Y34HTZXK.mjs');
|
|
15488
15683
|
} catch {
|
|
15489
15684
|
return { default: FailedToLoad6 };
|
|
15490
15685
|
}
|