pptx-react-viewer 2.0.0 → 2.1.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 +24 -0
- package/README.md +1 -1
- package/dist/{AiChatPanel-BRGQCYZM.mjs → AiChatPanel-RFBZWMUE.mjs} +2 -2
- package/dist/AiChatPanel-RFBZWMUE.mjs.br +0 -0
- package/dist/AiChatPanel-RFBZWMUE.mjs.gz +0 -0
- package/dist/{AiChatPanel-PW5OT25Z.js → AiChatPanel-VCCVHAAI.js} +10 -10
- package/dist/AiChatPanel-VCCVHAAI.js.br +0 -0
- package/dist/AiChatPanel-VCCVHAAI.js.gz +0 -0
- package/dist/{Model3DScene-TEF362W2.mjs → Model3DScene-2M6HVWTE.mjs} +1 -1
- package/dist/{Model3DScene-TEF362W2.mjs.br → Model3DScene-2M6HVWTE.mjs.br} +0 -0
- package/dist/Model3DScene-2M6HVWTE.mjs.gz +0 -0
- package/dist/{Model3DScene-JCGYRKXM.js → Model3DScene-RQIGSYGQ.js} +2 -2
- package/dist/{Model3DScene-JCGYRKXM.js.br → Model3DScene-RQIGSYGQ.js.br} +0 -0
- package/dist/Model3DScene-RQIGSYGQ.js.gz +0 -0
- package/dist/PowerPointViewer-gmU5rc7K.d.ts.map +1 -1
- package/dist/{SurfaceChart3DScene-2SHCYZVC.js → SurfaceChart3DScene-2FVASQGC.js} +2 -2
- package/dist/SurfaceChart3DScene-2FVASQGC.js.br +0 -0
- package/dist/SurfaceChart3DScene-2FVASQGC.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-UPDCIMJM.mjs → SurfaceChart3DScene-EGMWY4CZ.mjs} +1 -1
- package/dist/{SurfaceChart3DScene-UPDCIMJM.mjs.br → SurfaceChart3DScene-EGMWY4CZ.mjs.br} +0 -0
- package/dist/SurfaceChart3DScene-EGMWY4CZ.mjs.gz +0 -0
- package/dist/{chunk-R2N2UYT7.mjs → chunk-27XBWVO5.mjs} +310 -3
- package/dist/chunk-27XBWVO5.mjs.br +0 -0
- package/dist/{chunk-R2N2UYT7.mjs.gz → chunk-27XBWVO5.mjs.gz} +0 -0
- package/dist/{chunk-OKOJVSKJ.js → chunk-46Z6MNRS.js} +315 -2
- package/dist/chunk-46Z6MNRS.js.br +0 -0
- package/dist/{chunk-OKOJVSKJ.js.gz → chunk-46Z6MNRS.js.gz} +0 -0
- package/dist/{chunk-B6NRDUHJ.mjs → chunk-7DQHWPIB.mjs} +2 -2
- package/dist/chunk-7DQHWPIB.mjs.br +0 -0
- package/dist/chunk-7DQHWPIB.mjs.gz +0 -0
- package/dist/{chunk-ZKDE3HJI.js → chunk-LDF77JJD.js} +208 -208
- package/dist/chunk-LDF77JJD.js.br +0 -0
- package/dist/chunk-LDF77JJD.js.gz +0 -0
- package/dist/{chunk-5XLLRPMV.mjs → chunk-NGE7YQTF.mjs} +110 -14
- package/dist/chunk-NGE7YQTF.mjs.br +0 -0
- package/dist/chunk-NGE7YQTF.mjs.gz +0 -0
- package/dist/{chunk-LFXG7SGG.js → chunk-VHO53ZXZ.js} +764 -756
- package/dist/chunk-VHO53ZXZ.js.br +0 -0
- package/dist/chunk-VHO53ZXZ.js.gz +0 -0
- package/dist/{chunk-L63RAVM7.mjs → chunk-Y4OSELBT.mjs} +16 -8
- package/dist/chunk-Y4OSELBT.mjs.br +0 -0
- package/dist/chunk-Y4OSELBT.mjs.gz +0 -0
- package/dist/{chunk-ZB4NZRCI.js → chunk-ZRY7NLKS.js} +354 -257
- package/dist/chunk-ZRY7NLKS.js.br +0 -0
- package/dist/chunk-ZRY7NLKS.js.gz +0 -0
- package/dist/{index-a8wcFjRJ.d.ts → index-nAyIdGqF.d.ts} +2 -2
- package/dist/{index-a8wcFjRJ.d.ts.map → index-nAyIdGqF.d.ts.map} +1 -1
- package/dist/index.js +33 -33
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +100 -0
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +78 -78
- 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.js +20 -20
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +4 -4
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +5 -3
- package/dist/AiChatPanel-BRGQCYZM.mjs.br +0 -0
- package/dist/AiChatPanel-BRGQCYZM.mjs.gz +0 -0
- package/dist/AiChatPanel-PW5OT25Z.js.br +0 -0
- package/dist/AiChatPanel-PW5OT25Z.js.gz +0 -0
- package/dist/Model3DScene-JCGYRKXM.js.gz +0 -0
- package/dist/Model3DScene-TEF362W2.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-2SHCYZVC.js.br +0 -0
- package/dist/SurfaceChart3DScene-2SHCYZVC.js.gz +0 -0
- package/dist/SurfaceChart3DScene-UPDCIMJM.mjs.gz +0 -0
- package/dist/chunk-5XLLRPMV.mjs.br +0 -0
- package/dist/chunk-5XLLRPMV.mjs.gz +0 -0
- package/dist/chunk-B6NRDUHJ.mjs.br +0 -0
- package/dist/chunk-B6NRDUHJ.mjs.gz +0 -0
- package/dist/chunk-L63RAVM7.mjs.br +0 -0
- package/dist/chunk-L63RAVM7.mjs.gz +0 -0
- package/dist/chunk-LFXG7SGG.js.br +0 -0
- package/dist/chunk-LFXG7SGG.js.gz +0 -0
- package/dist/chunk-OKOJVSKJ.js.br +0 -0
- package/dist/chunk-R2N2UYT7.mjs.br +0 -0
- package/dist/chunk-ZB4NZRCI.js.br +0 -0
- package/dist/chunk-ZB4NZRCI.js.gz +0 -0
- package/dist/chunk-ZKDE3HJI.js.br +0 -0
- package/dist/chunk-ZKDE3HJI.js.gz +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cloneHistorySnapshot, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, MIN_ELEMENT_SIZE, ZOOM_TO_SELECTION_PADDING, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, partitionTemplateElements, UNGROUPED_SECTION_ID, stopAllPersistentAudio, buildSaveSlides, DEFAULT_TABLE_ROWS, DEFAULT_TABLE_COLUMNS, executeMediaCommand, buildPdfFromImageData, buildNotesPdf, EMU_PER_PX, GRID_SIZE, DEFAULT_TEXT_FONT_SIZE } from './chunk-
|
|
2
|
-
import { TOOLBAR_TABS, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, BROADCAST_THROTTLE_MS, createSyncGate, validateRoomId, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, sanitizeColor, cloneTemplateElementsBySlideId, cloneSlide, PresentationAnimationController, computeEntranceAnimationDelay, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, clearAudienceContent, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, storeAudienceContent, isPresentationSessionMessage, collectMediaElements, collectImagePaths, buildInitialGuides, saveAutosaveSnapshot, isTemplateElementId, getInlineEditorSelection, applyStyleToSelectedSegments, setPendingSelectionRestore, applyCaseTransformToSegments, transformTextCase, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, normalizeColorsForCapture, preprocessCssForCapture, downloadBlob, sanitizeDownloadFilename, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, recordProgressPercent, comparePresentation, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, detectTouchDevice, detectOrientation, isMobileViewport, MOBILE_BREAKPOINT, TABLET_BREAKPOINT, remapTextToSegments, shouldLoopContinuously, applyRehearsalTimings, copyFormatFromElement, applyFormatToElement, createViewerOptionsStore, readSlidesFromYDoc, reconcileSlidesInYDoc, LOCAL_SYNC_ORIGIN, observeYDocSlides, shouldAutoFollowBroadcaster, createTouchGestureRecognizer, isKeyboardOpen, openPptxFile, readBackstageRecentFile, isActionHidden, buildElementClipboardPayload, generatePackageReadme, groupElements, generateElementId, makeCloneId, alignElements, distributeElements, bringForward, sendBackward, bringToFront, sendToBack, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, derivePresenceList, buildPrintDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, makeSlideId, createPresentationSessionId, resolveTransitionDurationMs, isUrlSafe, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, presenterElapsed, stepPresenterZoom, resetPresenterTimer, togglePresenterTimer, canvasToJpegData, downloadDataUrl, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, encodeGif, groupSlidesBySection, hasCopyableFormat, createBackstagePresentation, cloneElementForPaste, computeScrollDelta, rerouteConnectorsForMovedElements, applyReroutedConnectors, buildPrintHtmlDocument, deleteTableColumn, insertTableColumn, deleteTableRow, insertTableRow, splitCell, mergeCells, isPpactionUrl, parsePpactionUrl, safeOpenUrl, ACTION_BUTTON_PRESETS, buildSmartArtPresetData, computeSnapToShape, computeMarqueeHitIds, mergeAdditiveSelection, applyResize, snapBoxToGrid } from './chunk-
|
|
1
|
+
import { cloneHistorySnapshot, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, MIN_ELEMENT_SIZE, ZOOM_TO_SELECTION_PADDING, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, partitionTemplateElements, UNGROUPED_SECTION_ID, stopAllPersistentAudio, buildSaveSlides, DEFAULT_TABLE_ROWS, DEFAULT_TABLE_COLUMNS, executeMediaCommand, buildPdfFromImageData, buildNotesPdf, EMU_PER_PX, GRID_SIZE, DEFAULT_TEXT_FONT_SIZE } from './chunk-7DQHWPIB.mjs';
|
|
2
|
+
import { TOOLBAR_TABS, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, BROADCAST_THROTTLE_MS, createSyncGate, clearLocalAwareness, validateRoomId, createDepartureChannel, resolveTransportForServerUrl, isMixedContentBlocked, CONNECTION_TIMEOUT_MS, registerCollaborationTeardown, sanitizeColor, cloneTemplateElementsBySlideId, cloneSlide, PresentationAnimationController, computeEntranceAnimationDelay, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, clearAudienceContent, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, storeAudienceContent, isPresentationSessionMessage, createCollaborationLivePatcher, publishLiveInlineText, collectMediaElements, collectImagePaths, buildInitialGuides, saveAutosaveSnapshot, isTemplateElementId, getInlineEditorSelection, applyStyleToSelectedSegments, setPendingSelectionRestore, applyCaseTransformToSegments, transformTextCase, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, normalizeColorsForCapture, preprocessCssForCapture, downloadBlob, sanitizeDownloadFilename, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, recordProgressPercent, comparePresentation, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, detectTouchDevice, detectOrientation, isMobileViewport, MOBILE_BREAKPOINT, TABLET_BREAKPOINT, remapTextToSegments, shouldLoopContinuously, applyRehearsalTimings, copyFormatFromElement, applyFormatToElement, createViewerOptionsStore, readSlidesFromYDoc, reconcileSlidesInYDoc, LOCAL_SYNC_ORIGIN, observeYDocSlides, shouldAutoFollowBroadcaster, createTouchGestureRecognizer, isKeyboardOpen, openPptxFile, readBackstageRecentFile, isActionHidden, buildElementClipboardPayload, generatePackageReadme, groupElements, generateElementId, makeCloneId, alignElements, distributeElements, bringForward, sendBackward, bringToFront, sendToBack, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, derivePresenceList, buildPrintDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, makeSlideId, createPresentationSessionId, resolveTransitionDurationMs, isUrlSafe, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, presenterElapsed, stepPresenterZoom, resetPresenterTimer, togglePresenterTimer, canvasToJpegData, downloadDataUrl, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, encodeGif, groupSlidesBySection, hasCopyableFormat, createBackstagePresentation, cloneElementForPaste, computeScrollDelta, rerouteConnectorsForMovedElements, applyReroutedConnectors, buildPrintHtmlDocument, deleteTableColumn, insertTableColumn, deleteTableRow, insertTableRow, splitCell, mergeCells, isPpactionUrl, parsePpactionUrl, safeOpenUrl, ACTION_BUTTON_PRESETS, buildSmartArtPresetData, computeSnapToShape, publishLiveGeometry, computeMarqueeHitIds, mergeAdditiveSelection, applyResize, snapBoxToGrid } from './chunk-27XBWVO5.mjs';
|
|
3
3
|
import { translationsEn } from './chunk-2X72MOPZ.mjs';
|
|
4
4
|
import { PptxHandler, EncryptedFileError, hasShapeProperties, hasTextProperties, applyThemeToData, THEME_PRESETS, themeColorSchemesEqual, guidePxToEmu, mergeShapes, buildThemeColorMap, reResolveSlideColors, getPresetShapeClipPath, svgPathToPolygons, polygonsToSvgPath, SvgExporter, rebuildTableStructureInRawXml, updateCellTextStyleInRawXml, updateCellTextInRawXml, updateMergeAttrsInRawXml, elementActionToPptxAction } from './chunk-6YXLGMTN.mjs';
|
|
5
5
|
import { useRef, useState, useEffect, useCallback, useMemo, useSyncExternalStore, useImperativeHandle } from 'react';
|
|
@@ -186,6 +186,7 @@ function useYjsProvider({ config }) {
|
|
|
186
186
|
const [synced, setSynced] = useState(false);
|
|
187
187
|
const cleanupRef = useRef(null);
|
|
188
188
|
const timeoutRef = useRef(null);
|
|
189
|
+
const departureRef = useRef(null);
|
|
189
190
|
const gateRef = useRef(null);
|
|
190
191
|
if (!gateRef.current) {
|
|
191
192
|
gateRef.current = createSyncGate(() => setSynced(true));
|
|
@@ -200,8 +201,15 @@ function useYjsProvider({ config }) {
|
|
|
200
201
|
cleanupRef.current?.();
|
|
201
202
|
cleanupRef.current = null;
|
|
202
203
|
}, []);
|
|
204
|
+
const announceDeparture = useCallback(() => {
|
|
205
|
+
departureRef.current?.announce();
|
|
206
|
+
departureRef.current?.dispose();
|
|
207
|
+
departureRef.current = null;
|
|
208
|
+
}, []);
|
|
203
209
|
const buildCleanup = useCallback(
|
|
204
210
|
(provider, yDoc) => () => {
|
|
211
|
+
announceDeparture();
|
|
212
|
+
clearLocalAwareness(provider.awareness);
|
|
205
213
|
provider.destroy();
|
|
206
214
|
yDoc.destroy();
|
|
207
215
|
setDoc(null);
|
|
@@ -209,7 +217,7 @@ function useYjsProvider({ config }) {
|
|
|
209
217
|
setClientId(null);
|
|
210
218
|
setStatus("disconnected");
|
|
211
219
|
},
|
|
212
|
-
[]
|
|
220
|
+
[announceDeparture]
|
|
213
221
|
);
|
|
214
222
|
const initWebrtc = useCallback(async () => {
|
|
215
223
|
if (!config) {
|
|
@@ -226,7 +234,9 @@ function useYjsProvider({ config }) {
|
|
|
226
234
|
if (config.authToken) {
|
|
227
235
|
opts.password = config.authToken;
|
|
228
236
|
}
|
|
229
|
-
const
|
|
237
|
+
const roomId = validateRoomId(config.roomId);
|
|
238
|
+
const provider = new WebrtcProvider(roomId, yDoc, opts);
|
|
239
|
+
departureRef.current = createDepartureChannel(roomId, provider.awareness);
|
|
230
240
|
setDoc(yDoc);
|
|
231
241
|
setAwareness(provider.awareness);
|
|
232
242
|
setClientId(provider.awareness.clientID);
|
|
@@ -288,6 +298,7 @@ function useYjsProvider({ config }) {
|
|
|
288
298
|
const provider = new WebsocketProvider(config.serverUrl, roomId, yDoc, {
|
|
289
299
|
params: config.authToken ? { token: config.authToken } : void 0
|
|
290
300
|
});
|
|
301
|
+
departureRef.current = createDepartureChannel(roomId, provider.awareness);
|
|
291
302
|
let connected = false;
|
|
292
303
|
const handleStatus = (event) => {
|
|
293
304
|
if (event.status === "connected") {
|
|
@@ -326,6 +337,8 @@ function useYjsProvider({ config }) {
|
|
|
326
337
|
if (!connected) {
|
|
327
338
|
provider.off("status", handleStatus);
|
|
328
339
|
provider.off("sync", handleSynced);
|
|
340
|
+
announceDeparture();
|
|
341
|
+
clearLocalAwareness(provider.awareness);
|
|
329
342
|
provider.destroy();
|
|
330
343
|
yDoc.destroy();
|
|
331
344
|
setDoc(null);
|
|
@@ -342,6 +355,8 @@ function useYjsProvider({ config }) {
|
|
|
342
355
|
cleanupRef.current = () => {
|
|
343
356
|
provider.off("status", handleStatus);
|
|
344
357
|
provider.off("sync", handleSynced);
|
|
358
|
+
announceDeparture();
|
|
359
|
+
clearLocalAwareness(provider.awareness);
|
|
345
360
|
provider.destroy();
|
|
346
361
|
yDoc.destroy();
|
|
347
362
|
setDoc(null);
|
|
@@ -361,12 +376,20 @@ function useYjsProvider({ config }) {
|
|
|
361
376
|
config?.serverUrl,
|
|
362
377
|
config?.authToken,
|
|
363
378
|
config?.transport,
|
|
379
|
+
announceDeparture,
|
|
364
380
|
initWebrtc,
|
|
365
381
|
teardown
|
|
366
382
|
]);
|
|
367
383
|
useEffect(() => {
|
|
368
384
|
init();
|
|
369
|
-
|
|
385
|
+
const disposeTeardown = registerCollaborationTeardown({
|
|
386
|
+
leave: teardown,
|
|
387
|
+
rejoin: init
|
|
388
|
+
});
|
|
389
|
+
return () => {
|
|
390
|
+
disposeTeardown();
|
|
391
|
+
teardown();
|
|
392
|
+
};
|
|
370
393
|
}, [init, teardown]);
|
|
371
394
|
const retry = useCallback(() => {
|
|
372
395
|
init();
|
|
@@ -3293,6 +3316,9 @@ function useViewerCoreState(_input) {
|
|
|
3293
3316
|
const shapeAdjustmentDragStateRef = useRef(null);
|
|
3294
3317
|
const marqueeStateRef = useRef(null);
|
|
3295
3318
|
const isDrawingRef = useRef(false);
|
|
3319
|
+
const livePatcher = useMemo(() => createCollaborationLivePatcher(), []);
|
|
3320
|
+
useEffect(() => () => livePatcher.dispose(), [livePatcher]);
|
|
3321
|
+
const slidesRef = useRef([]);
|
|
3296
3322
|
const [mode, setMode] = useState("edit");
|
|
3297
3323
|
const [loading, setLoading] = useState(true);
|
|
3298
3324
|
const [error, setError] = useState(null);
|
|
@@ -3320,8 +3346,14 @@ function useViewerCoreState(_input) {
|
|
|
3320
3346
|
const resolved = typeof value === "function" ? value(inlineEditingTextRef.current) : value;
|
|
3321
3347
|
inlineEditingTextRef.current = resolved;
|
|
3322
3348
|
setInlineEditingTextBase(value);
|
|
3349
|
+
publishLiveInlineText(
|
|
3350
|
+
livePatcher,
|
|
3351
|
+
slidesRef.current[activeSlideIndexRef.current],
|
|
3352
|
+
inlineEditingElementIdRef.current,
|
|
3353
|
+
resolved
|
|
3354
|
+
);
|
|
3323
3355
|
},
|
|
3324
|
-
[]
|
|
3356
|
+
[livePatcher]
|
|
3325
3357
|
);
|
|
3326
3358
|
const [editTemplateMode, setEditTemplateMode] = useState(false);
|
|
3327
3359
|
const [newShapeType, setNewShapeType] = useState("rect");
|
|
@@ -3355,6 +3387,7 @@ function useViewerCoreState(_input) {
|
|
|
3355
3387
|
const [preMasterMode, setPreMasterMode] = useState("edit");
|
|
3356
3388
|
const [masterViewTab, setMasterViewTab] = useState("slides");
|
|
3357
3389
|
const [handoutSlidesPerPage, setHandoutSlidesPerPage] = useState(4);
|
|
3390
|
+
slidesRef.current = slides;
|
|
3358
3391
|
const derived = useDerivedElementState({
|
|
3359
3392
|
slides,
|
|
3360
3393
|
activeSlideIndex,
|
|
@@ -3379,6 +3412,7 @@ function useViewerCoreState(_input) {
|
|
|
3379
3412
|
shapeAdjustmentDragStateRef,
|
|
3380
3413
|
marqueeStateRef,
|
|
3381
3414
|
isDrawingRef,
|
|
3415
|
+
livePatcher,
|
|
3382
3416
|
mode,
|
|
3383
3417
|
setMode,
|
|
3384
3418
|
loading,
|
|
@@ -4166,6 +4200,13 @@ function computeAdjustmentValue(startAdjustment, dx, startWidth) {
|
|
|
4166
4200
|
const delta = dx / range;
|
|
4167
4201
|
return Math.max(0, Math.min(1, startAdjustment + delta));
|
|
4168
4202
|
}
|
|
4203
|
+
function resolveLiveTarget(input) {
|
|
4204
|
+
const { livePatcher, editTemplateMode, activeSlide } = input;
|
|
4205
|
+
if (!livePatcher || editTemplateMode || !livePatcher.isActive()) {
|
|
4206
|
+
return void 0;
|
|
4207
|
+
}
|
|
4208
|
+
return { patcher: livePatcher, slideId: activeSlide?.id };
|
|
4209
|
+
}
|
|
4169
4210
|
function processPointerMove(e, input, tracker) {
|
|
4170
4211
|
const {
|
|
4171
4212
|
editorScale,
|
|
@@ -4214,13 +4255,14 @@ function processPointerMove(e, input, tracker) {
|
|
|
4214
4255
|
guides,
|
|
4215
4256
|
elementLookup,
|
|
4216
4257
|
tracker,
|
|
4217
|
-
setSnapLines
|
|
4258
|
+
setSnapLines,
|
|
4259
|
+
resolveLiveTarget(input)
|
|
4218
4260
|
);
|
|
4219
4261
|
return;
|
|
4220
4262
|
}
|
|
4221
4263
|
const rs = resizeStateRef.current;
|
|
4222
4264
|
if (rs) {
|
|
4223
|
-
processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx);
|
|
4265
|
+
processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, resolveLiveTarget(input));
|
|
4224
4266
|
return;
|
|
4225
4267
|
}
|
|
4226
4268
|
const adj = shapeAdjustmentDragStateRef.current;
|
|
@@ -4238,7 +4280,7 @@ function processMarqueeMove(e, marquee, canvasStageRef, canvasSize, editorScale,
|
|
|
4238
4280
|
marquee.currentY = Math.max(0, Math.min(canvasSize.height, (e.clientY - rect.top) / editorScale));
|
|
4239
4281
|
setMarqueeSelectionState({ ...marquee });
|
|
4240
4282
|
}
|
|
4241
|
-
function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpacingPx, editTemplateMode, templateElements, activeSlide, guides, elementLookup, tracker, setSnapLines) {
|
|
4283
|
+
function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpacingPx, editTemplateMode, templateElements, activeSlide, guides, elementLookup, tracker, setSnapLines, live) {
|
|
4242
4284
|
const dx = (e.clientX - drag.startClientX) / editorScale;
|
|
4243
4285
|
const dy = (e.clientY - drag.startClientY) / editorScale;
|
|
4244
4286
|
if (!drag.moved && (Math.abs(dx) > 2 || Math.abs(dy) > 2)) {
|
|
@@ -4305,8 +4347,17 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4305
4347
|
domEl.style.top = `${start.y + appliedDy}px`;
|
|
4306
4348
|
}
|
|
4307
4349
|
}
|
|
4350
|
+
if (live) {
|
|
4351
|
+
for (const id of Object.keys(drag.startPositionsById)) {
|
|
4352
|
+
const start = drag.startPositionsById[id];
|
|
4353
|
+
publishLiveGeometry(live.patcher, live.slideId, id, {
|
|
4354
|
+
x: start.x + appliedDx,
|
|
4355
|
+
y: start.y + appliedDy
|
|
4356
|
+
});
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4308
4359
|
}
|
|
4309
|
-
function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx) {
|
|
4360
|
+
function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live) {
|
|
4310
4361
|
const dx = (e.clientX - rs.startClientX) / editorScale;
|
|
4311
4362
|
const dy = (e.clientY - rs.startClientY) / editorScale;
|
|
4312
4363
|
if (!rs.moved && (Math.abs(dx) > 2 || Math.abs(dy) > 2)) {
|
|
@@ -4336,6 +4387,14 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx) {
|
|
|
4336
4387
|
rs.domEl.style.width = `${Math.max(geo.width, MIN_ELEMENT_SIZE)}px`;
|
|
4337
4388
|
rs.domEl.style.height = `${Math.max(geo.height, MIN_ELEMENT_SIZE)}px`;
|
|
4338
4389
|
}
|
|
4390
|
+
if (live) {
|
|
4391
|
+
publishLiveGeometry(live.patcher, live.slideId, rs.elementId, {
|
|
4392
|
+
x: geo.x,
|
|
4393
|
+
y: geo.y,
|
|
4394
|
+
width: Math.max(geo.width, MIN_ELEMENT_SIZE),
|
|
4395
|
+
height: Math.max(geo.height, MIN_ELEMENT_SIZE)
|
|
4396
|
+
});
|
|
4397
|
+
}
|
|
4339
4398
|
}
|
|
4340
4399
|
function processAdjustmentMove(e, adj, editorScale, updateElementById) {
|
|
4341
4400
|
const dx = (e.clientX - adj.startClientX) / editorScale;
|
|
@@ -4369,7 +4428,8 @@ function processPointerUp(input) {
|
|
|
4369
4428
|
clearSelection,
|
|
4370
4429
|
updateSlides,
|
|
4371
4430
|
updateElementById,
|
|
4372
|
-
markDirty
|
|
4431
|
+
markDirty,
|
|
4432
|
+
livePatcher
|
|
4373
4433
|
} = input;
|
|
4374
4434
|
const marquee = marqueeStateRef.current;
|
|
4375
4435
|
const drag = dragStateRef.current;
|
|
@@ -4424,6 +4484,9 @@ function processPointerUp(input) {
|
|
|
4424
4484
|
);
|
|
4425
4485
|
}
|
|
4426
4486
|
const wasMoved = drag?.moved || rs?.moved || adj?.moved;
|
|
4487
|
+
if (wasMoved) {
|
|
4488
|
+
livePatcher?.flush();
|
|
4489
|
+
}
|
|
4427
4490
|
marqueeStateRef.current = null;
|
|
4428
4491
|
dragStateRef.current = null;
|
|
4429
4492
|
resizeStateRef.current = null;
|
|
@@ -4508,7 +4571,8 @@ function usePointerHandlers(input) {
|
|
|
4508
4571
|
clearSelection,
|
|
4509
4572
|
updateSlides,
|
|
4510
4573
|
updateElementById,
|
|
4511
|
-
markDirty
|
|
4574
|
+
markDirty,
|
|
4575
|
+
livePatcher
|
|
4512
4576
|
} = input;
|
|
4513
4577
|
useEffect(() => {
|
|
4514
4578
|
const tracker = {
|
|
@@ -4572,6 +4636,7 @@ function usePointerHandlers(input) {
|
|
|
4572
4636
|
updateSlides,
|
|
4573
4637
|
updateElementById,
|
|
4574
4638
|
markDirty,
|
|
4639
|
+
livePatcher,
|
|
4575
4640
|
input
|
|
4576
4641
|
]);
|
|
4577
4642
|
}
|
|
@@ -9391,7 +9456,8 @@ function useViewerIntegration(input) {
|
|
|
9391
9456
|
clearSelection: editorOps.ops.clearSelection,
|
|
9392
9457
|
updateSlides: editorOps.ops.updateSlides,
|
|
9393
9458
|
updateElementById: editorOps.ops.updateElementById,
|
|
9394
|
-
markDirty: history.markDirty
|
|
9459
|
+
markDirty: history.markDirty,
|
|
9460
|
+
livePatcher: state.livePatcher
|
|
9395
9461
|
});
|
|
9396
9462
|
const [isEncryptedDialogOpen, setIsEncryptedDialogOpen] = useState(false);
|
|
9397
9463
|
const [loadVersion, setLoadVersion] = useState(0);
|
|
@@ -9976,6 +10042,36 @@ function useFollowMode({
|
|
|
9976
10042
|
}, [activeSlideIndex, followedClientId]);
|
|
9977
10043
|
return { followedClientId, followUser };
|
|
9978
10044
|
}
|
|
10045
|
+
function useCollaborationLivePatch({
|
|
10046
|
+
patcher,
|
|
10047
|
+
doc,
|
|
10048
|
+
isConnected,
|
|
10049
|
+
isSynced = true
|
|
10050
|
+
}) {
|
|
10051
|
+
useEffect(() => {
|
|
10052
|
+
if (!doc || !isConnected || !isSynced) {
|
|
10053
|
+
patcher.configure(null, null);
|
|
10054
|
+
return;
|
|
10055
|
+
}
|
|
10056
|
+
let cancelled = false;
|
|
10057
|
+
void (async () => {
|
|
10058
|
+
const Y = await import('./yjs-FKGX4QHS.mjs');
|
|
10059
|
+
if (cancelled) {
|
|
10060
|
+
return;
|
|
10061
|
+
}
|
|
10062
|
+
const factories = {
|
|
10063
|
+
createMap: () => new Y.Map(),
|
|
10064
|
+
createArray: () => new Y.Array(),
|
|
10065
|
+
createText: () => new Y.Text()
|
|
10066
|
+
};
|
|
10067
|
+
patcher.configure(doc, factories);
|
|
10068
|
+
})();
|
|
10069
|
+
return () => {
|
|
10070
|
+
cancelled = true;
|
|
10071
|
+
patcher.configure(null, null);
|
|
10072
|
+
};
|
|
10073
|
+
}, [patcher, doc, isConnected, isSynced]);
|
|
10074
|
+
}
|
|
9979
10075
|
function useLayoutSwitching(input) {
|
|
9980
10076
|
const { handler, slides, activeSlideIndex, ops, history } = input;
|
|
9981
10077
|
const [availableLayouts, setAvailableLayouts] = useState([]);
|
|
@@ -11022,4 +11118,4 @@ function useResizablePanels() {
|
|
|
11022
11118
|
};
|
|
11023
11119
|
}
|
|
11024
11120
|
|
|
11025
|
-
export { ACTION_VERB_MAP, MIN_TOUCH_TARGET, computeToolbarVisibility, detectTargetType, downloadBlob2 as downloadBlob, isAudienceTab, parseAudienceNonce, parseEmailUrl, parseSlideFromUrl, renderToCanvas, scopeLayoutOptionsToActiveSlide, useAnimationPlayback, useAnnotationHandlers, useAudienceMode, useAutosave, useBroadcastFollower, useCanvasInteractions, useClipboardHandlers, useCollaborativeHistory, useCollaborativeState, useComments, useContentLifecycle, useDerivedElementState, useDerivedSlideState, useDialogCustomShows, useEditorHistory, useEditorOperations, useElementManipulation, useElementOperations, useExportHandlers, useExportSaveAs, useFindReplace, useFollowMode, useFontInjection, useGroupAlignLayerHandlers, useIOHandlers, useInsertElements, useIsMobile, useKeyboardInsets, useKeyboardShortcutWiring, useKeyboardShortcuts, useLayoutSwitching, useLoadContent, useMergeShapesHandler, useModalDismissDrag, usePointerHandlers, usePresenceTracking, usePresentationAnnotations, usePresentationKeyboard, usePresentationMode, usePresentationSetup, usePresenterWindow, usePrintHandlers, usePropertyHandlers, useRecoveryDetection, useReducedMotion, useRehearsalTimings, useResizablePanels, useSectionOperations, useSerialize, useSheetDismissDrag, useSlideManagement, useSlideNavigation, useSwipeNavigation, useTableOperations, useThemeHandlers, useThemeSwitching, useToolbarVisibility, useTouchGestures, useViewerBuildingBlocks, useViewerCoreState, useViewerDialogs, useViewerIntegration, useViewerOptions, useViewerState, useViewerUIState, useVirtualizedSlides, useYjsDocumentSync, useYjsProvider, useZoomNavigation, useZoomViewport };
|
|
11121
|
+
export { ACTION_VERB_MAP, MIN_TOUCH_TARGET, computeToolbarVisibility, detectTargetType, downloadBlob2 as downloadBlob, isAudienceTab, parseAudienceNonce, parseEmailUrl, parseSlideFromUrl, renderToCanvas, scopeLayoutOptionsToActiveSlide, useAnimationPlayback, useAnnotationHandlers, useAudienceMode, useAutosave, useBroadcastFollower, useCanvasInteractions, useClipboardHandlers, useCollaborationLivePatch, useCollaborativeHistory, useCollaborativeState, useComments, useContentLifecycle, useDerivedElementState, useDerivedSlideState, useDialogCustomShows, useEditorHistory, useEditorOperations, useElementManipulation, useElementOperations, useExportHandlers, useExportSaveAs, useFindReplace, useFollowMode, useFontInjection, useGroupAlignLayerHandlers, useIOHandlers, useInsertElements, useIsMobile, useKeyboardInsets, useKeyboardShortcutWiring, useKeyboardShortcuts, useLayoutSwitching, useLoadContent, useMergeShapesHandler, useModalDismissDrag, usePointerHandlers, usePresenceTracking, usePresentationAnnotations, usePresentationKeyboard, usePresentationMode, usePresentationSetup, usePresenterWindow, usePrintHandlers, usePropertyHandlers, useRecoveryDetection, useReducedMotion, useRehearsalTimings, useResizablePanels, useSectionOperations, useSerialize, useSheetDismissDrag, useSlideManagement, useSlideNavigation, useSwipeNavigation, useTableOperations, useThemeHandlers, useThemeSwitching, useToolbarVisibility, useTouchGestures, useViewerBuildingBlocks, useViewerCoreState, useViewerDialogs, useViewerIntegration, useViewerOptions, useViewerState, useViewerUIState, useVirtualizedSlides, useYjsDocumentSync, useYjsProvider, useZoomNavigation, useZoomViewport };
|
|
Binary file
|
|
Binary file
|