pptx-react-viewer 3.17.1 → 3.18.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 +6 -0
- package/README.md +33 -31
- package/dist/{AiChatPanel-SINEEZBW.mjs → AiChatPanel-DDZC6IRK.mjs} +4 -4
- package/dist/AiChatPanel-DDZC6IRK.mjs.br +0 -0
- package/dist/AiChatPanel-DDZC6IRK.mjs.gz +0 -0
- package/dist/{AiChatPanel-GYH43XWW.js → AiChatPanel-T2QSCUQR.js} +25 -25
- package/dist/AiChatPanel-T2QSCUQR.js.br +0 -0
- package/dist/AiChatPanel-T2QSCUQR.js.gz +0 -0
- package/dist/{Area3DChartScene-D7GSJGPQ.js → Area3DChartScene-WEU2MP3B.js} +2 -2
- package/dist/Area3DChartScene-WEU2MP3B.js.br +0 -0
- package/dist/Area3DChartScene-WEU2MP3B.js.gz +0 -0
- package/dist/{Area3DChartScene-X5SM67PZ.mjs → Area3DChartScene-WTKQDHC7.mjs} +1 -1
- package/dist/Area3DChartScene-WTKQDHC7.mjs.br +0 -0
- package/dist/Area3DChartScene-WTKQDHC7.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-M72WQW5Y.js → Bar3DChartScene-25G6TG53.js} +2 -2
- package/dist/Bar3DChartScene-25G6TG53.js.br +0 -0
- package/dist/Bar3DChartScene-25G6TG53.js.gz +0 -0
- package/dist/{Bar3DChartScene-HWIFFGI3.mjs → Bar3DChartScene-A5ICLHXS.mjs} +1 -1
- package/dist/{Bar3DChartScene-HWIFFGI3.mjs.br → Bar3DChartScene-A5ICLHXS.mjs.br} +0 -0
- package/dist/Bar3DChartScene-A5ICLHXS.mjs.gz +0 -0
- package/dist/{GLTFLoader-374ZNTXW.mjs → GLTFLoader-IWJFC4XI.mjs} +54 -16
- package/dist/GLTFLoader-IWJFC4XI.mjs.br +0 -0
- package/dist/GLTFLoader-IWJFC4XI.mjs.gz +0 -0
- package/dist/{GLTFLoader-Q7BHCGAW.js → GLTFLoader-KY7AYPMX.js} +178 -140
- package/dist/GLTFLoader-KY7AYPMX.js.br +0 -0
- package/dist/GLTFLoader-KY7AYPMX.js.gz +0 -0
- package/dist/{Line3DChartScene-7MPZWVF3.mjs → Line3DChartScene-ARCDLHXQ.mjs} +1 -1
- package/dist/Line3DChartScene-ARCDLHXQ.mjs.br +0 -0
- package/dist/Line3DChartScene-ARCDLHXQ.mjs.gz +0 -0
- package/dist/{Line3DChartScene-YOZEEQZ3.js → Line3DChartScene-WRZ52Z2Z.js} +2 -2
- package/dist/Line3DChartScene-WRZ52Z2Z.js.br +0 -0
- package/dist/Line3DChartScene-WRZ52Z2Z.js.gz +0 -0
- package/dist/{Model3DScene-5IJSNGDZ.js → Model3DScene-JGUG5NPX.js} +2 -2
- package/dist/Model3DScene-JGUG5NPX.js.br +0 -0
- package/dist/Model3DScene-JGUG5NPX.js.gz +0 -0
- package/dist/{Model3DScene-57LVY5QW.mjs → Model3DScene-PBKBL2YU.mjs} +1 -1
- package/dist/Model3DScene-PBKBL2YU.mjs.br +0 -0
- package/dist/Model3DScene-PBKBL2YU.mjs.gz +0 -0
- package/dist/OrbitControls-2XOMWUVE.mjs +3 -0
- package/dist/OrbitControls-2XOMWUVE.mjs.br +0 -0
- package/dist/OrbitControls-2XOMWUVE.mjs.gz +0 -0
- package/dist/OrbitControls-CGYUF3BY.js +12 -0
- package/dist/OrbitControls-CGYUF3BY.js.br +0 -0
- package/dist/OrbitControls-CGYUF3BY.js.gz +0 -0
- package/dist/{PieChart3DScene-UBI6X66Q.js → PieChart3DScene-S25DNSRS.js} +2 -2
- package/dist/PieChart3DScene-S25DNSRS.js.br +0 -0
- package/dist/PieChart3DScene-S25DNSRS.js.gz +0 -0
- package/dist/{PieChart3DScene-WD5B6NP3.mjs → PieChart3DScene-ZNKXS62H.mjs} +1 -1
- package/dist/{PieChart3DScene-WD5B6NP3.mjs.br → PieChart3DScene-ZNKXS62H.mjs.br} +0 -0
- package/dist/PieChart3DScene-ZNKXS62H.mjs.gz +0 -0
- package/dist/{SmartArt3DScene-ODKCGJBO.mjs → SmartArt3DScene-QZGIABOK.mjs} +2 -2
- package/dist/SmartArt3DScene-QZGIABOK.mjs.br +0 -0
- package/dist/SmartArt3DScene-QZGIABOK.mjs.gz +0 -0
- package/dist/{SmartArt3DScene-BK7QN3WT.js → SmartArt3DScene-T236GYUT.js} +33 -33
- package/dist/SmartArt3DScene-T236GYUT.js.br +0 -0
- package/dist/SmartArt3DScene-T236GYUT.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-JZGU6BBD.mjs → SurfaceChart3DScene-EBT7RPCX.mjs} +1 -1
- package/dist/SurfaceChart3DScene-EBT7RPCX.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-EBT7RPCX.mjs.gz +0 -0
- package/dist/{SurfaceChart3DScene-JGNPYQ32.js → SurfaceChart3DScene-LXBC3HMV.js} +2 -2
- package/dist/SurfaceChart3DScene-LXBC3HMV.js.br +0 -0
- package/dist/SurfaceChart3DScene-LXBC3HMV.js.gz +0 -0
- package/dist/{chunk-KVXB22D3.js → chunk-2LTTSFLD.js} +5 -5
- package/dist/chunk-2LTTSFLD.js.br +0 -0
- package/dist/chunk-2LTTSFLD.js.gz +0 -0
- package/dist/{chunk-VYSMTC5C.mjs → chunk-2OCTGK4L.mjs} +6 -110
- package/dist/chunk-2OCTGK4L.mjs.br +0 -0
- package/dist/chunk-2OCTGK4L.mjs.gz +0 -0
- package/dist/{chunk-IXKAIIA2.mjs → chunk-3KKPRPVE.mjs} +114 -126
- package/dist/chunk-3KKPRPVE.mjs.br +0 -0
- package/dist/chunk-3KKPRPVE.mjs.gz +0 -0
- package/dist/{chunk-B4QYQLZU.js → chunk-3N6AC4HA.js} +1122 -693
- package/dist/chunk-3N6AC4HA.js.br +0 -0
- package/dist/chunk-3N6AC4HA.js.gz +0 -0
- package/dist/{chunk-OAKDJYYT.mjs → chunk-5S3A6HL3.mjs} +121 -42
- package/dist/chunk-5S3A6HL3.mjs.br +0 -0
- package/dist/chunk-5S3A6HL3.mjs.gz +0 -0
- package/dist/{chunk-IRG7SIUX.js → chunk-6R2EUDJQ.js} +1399 -1411
- package/dist/chunk-6R2EUDJQ.js.br +0 -0
- package/dist/chunk-6R2EUDJQ.js.gz +0 -0
- package/dist/{chunk-XBMKFZVP.mjs → chunk-7TAWW5QQ.mjs} +1120 -694
- package/dist/chunk-7TAWW5QQ.mjs.br +0 -0
- package/dist/chunk-7TAWW5QQ.mjs.gz +0 -0
- package/dist/{chunk-64FUV37N.js → chunk-BRJN3ZMG.js} +2 -1
- package/dist/chunk-BRJN3ZMG.js.br +0 -0
- package/dist/{chunk-64FUV37N.js.gz → chunk-BRJN3ZMG.js.gz} +0 -0
- package/dist/{chunk-QTGCOL5H.mjs → chunk-GNRVDNCV.mjs} +1707 -435
- package/dist/chunk-GNRVDNCV.mjs.br +0 -0
- package/dist/chunk-GNRVDNCV.mjs.gz +0 -0
- package/dist/{chunk-6C2WYLZY.js → chunk-IXS7DALE.js} +45 -39
- package/dist/chunk-IXS7DALE.js.br +0 -0
- package/dist/chunk-IXS7DALE.js.gz +0 -0
- package/dist/{chunk-7FBKS7OS.js → chunk-LJ46KXUV.js} +179 -283
- package/dist/chunk-LJ46KXUV.js.br +0 -0
- package/dist/chunk-LJ46KXUV.js.gz +0 -0
- package/dist/{chunk-LAU34UMB.mjs → chunk-MQUTXOET.mjs} +2 -1
- package/dist/chunk-MQUTXOET.mjs.br +0 -0
- package/dist/{chunk-LAU34UMB.mjs.gz → chunk-MQUTXOET.mjs.gz} +0 -0
- package/dist/{chunk-3CBDTD46.mjs → chunk-MV2GCDBR.mjs} +8 -2
- package/dist/chunk-MV2GCDBR.mjs.br +0 -0
- package/dist/chunk-MV2GCDBR.mjs.gz +0 -0
- package/dist/{chunk-4SPZ5IZN.js → chunk-V32F4I45.js} +1713 -439
- package/dist/chunk-V32F4I45.js.br +0 -0
- package/dist/chunk-V32F4I45.js.gz +0 -0
- package/dist/{chunk-E55VEC37.js → chunk-WGBXO4LM.js} +576 -497
- package/dist/chunk-WGBXO4LM.js.br +0 -0
- package/dist/chunk-WGBXO4LM.js.gz +0 -0
- package/dist/{chunk-7YJBRPCT.mjs → chunk-WRO37U2O.mjs} +1 -1
- package/dist/chunk-WRO37U2O.mjs.br +0 -0
- package/dist/chunk-WRO37U2O.mjs.gz +0 -0
- package/dist/i18n.js +4 -4
- package/dist/i18n.js.br +0 -0
- package/dist/i18n.js.gz +0 -0
- package/dist/i18n.mjs +1 -1
- package/dist/i18n.mjs.br +0 -0
- package/dist/i18n.mjs.gz +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +47 -47
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +18 -0
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +79 -79
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +4 -4
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/pptx-viewer.css +1 -1
- package/dist/pptx-viewer.css.br +0 -0
- package/dist/pptx-viewer.css.gz +0 -0
- package/dist/three.module-LGUV2LI6.mjs +2 -0
- package/dist/three.module-LGUV2LI6.mjs.br +0 -0
- package/dist/three.module-LGUV2LI6.mjs.gz +0 -0
- package/dist/{three.module-GNNNRIMK.js → three.module-YZ4M24WM.js} +454 -442
- package/dist/three.module-YZ4M24WM.js.br +0 -0
- package/dist/three.module-YZ4M24WM.js.gz +0 -0
- package/dist/{useViewerBuildingBlocks-DkUGmlkP.d.ts → useViewerBuildingBlocks-4Tj6P8Fm.d.ts} +3 -1
- package/dist/useViewerBuildingBlocks-4Tj6P8Fm.d.ts.map +1 -0
- package/dist/viewer/index.js +27 -27
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +6 -6
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +3 -3
- package/dist/AiChatPanel-GYH43XWW.js.br +0 -0
- package/dist/AiChatPanel-GYH43XWW.js.gz +0 -0
- package/dist/AiChatPanel-SINEEZBW.mjs.br +0 -0
- package/dist/AiChatPanel-SINEEZBW.mjs.gz +0 -0
- package/dist/Area3DChartScene-D7GSJGPQ.js.br +0 -0
- package/dist/Area3DChartScene-D7GSJGPQ.js.gz +0 -0
- package/dist/Area3DChartScene-X5SM67PZ.mjs.br +0 -0
- package/dist/Area3DChartScene-X5SM67PZ.mjs.gz +0 -0
- package/dist/Bar3DChartScene-HWIFFGI3.mjs.gz +0 -0
- package/dist/Bar3DChartScene-M72WQW5Y.js.br +0 -0
- package/dist/Bar3DChartScene-M72WQW5Y.js.gz +0 -0
- package/dist/GLTFLoader-374ZNTXW.mjs.br +0 -0
- package/dist/GLTFLoader-374ZNTXW.mjs.gz +0 -0
- package/dist/GLTFLoader-Q7BHCGAW.js.br +0 -0
- package/dist/GLTFLoader-Q7BHCGAW.js.gz +0 -0
- package/dist/Line3DChartScene-7MPZWVF3.mjs.br +0 -0
- package/dist/Line3DChartScene-7MPZWVF3.mjs.gz +0 -0
- package/dist/Line3DChartScene-YOZEEQZ3.js.br +0 -0
- package/dist/Line3DChartScene-YOZEEQZ3.js.gz +0 -0
- package/dist/Model3DScene-57LVY5QW.mjs.br +0 -0
- package/dist/Model3DScene-57LVY5QW.mjs.gz +0 -0
- package/dist/Model3DScene-5IJSNGDZ.js.br +0 -0
- package/dist/Model3DScene-5IJSNGDZ.js.gz +0 -0
- package/dist/OrbitControls-SMYCPLXO.js +0 -12
- package/dist/OrbitControls-SMYCPLXO.js.br +0 -3
- package/dist/OrbitControls-SMYCPLXO.js.gz +0 -0
- package/dist/OrbitControls-ZTGHPI5G.mjs +0 -3
- package/dist/OrbitControls-ZTGHPI5G.mjs.br +0 -0
- package/dist/OrbitControls-ZTGHPI5G.mjs.gz +0 -0
- package/dist/PieChart3DScene-UBI6X66Q.js.br +0 -0
- package/dist/PieChart3DScene-UBI6X66Q.js.gz +0 -0
- package/dist/PieChart3DScene-WD5B6NP3.mjs.gz +0 -0
- package/dist/SmartArt3DScene-BK7QN3WT.js.br +0 -0
- package/dist/SmartArt3DScene-BK7QN3WT.js.gz +0 -0
- package/dist/SmartArt3DScene-ODKCGJBO.mjs.br +0 -0
- package/dist/SmartArt3DScene-ODKCGJBO.mjs.gz +0 -0
- package/dist/SurfaceChart3DScene-JGNPYQ32.js.br +0 -0
- package/dist/SurfaceChart3DScene-JGNPYQ32.js.gz +0 -0
- package/dist/SurfaceChart3DScene-JZGU6BBD.mjs.br +0 -0
- package/dist/SurfaceChart3DScene-JZGU6BBD.mjs.gz +0 -0
- package/dist/chunk-3CBDTD46.mjs.br +0 -0
- package/dist/chunk-3CBDTD46.mjs.gz +0 -0
- package/dist/chunk-4SPZ5IZN.js.br +0 -0
- package/dist/chunk-4SPZ5IZN.js.gz +0 -0
- package/dist/chunk-64FUV37N.js.br +0 -0
- package/dist/chunk-6C2WYLZY.js.br +0 -0
- package/dist/chunk-6C2WYLZY.js.gz +0 -0
- package/dist/chunk-7FBKS7OS.js.br +0 -0
- package/dist/chunk-7FBKS7OS.js.gz +0 -0
- package/dist/chunk-7YJBRPCT.mjs.br +0 -0
- package/dist/chunk-7YJBRPCT.mjs.gz +0 -0
- package/dist/chunk-B4QYQLZU.js.br +0 -0
- package/dist/chunk-B4QYQLZU.js.gz +0 -0
- package/dist/chunk-E55VEC37.js.br +0 -0
- package/dist/chunk-E55VEC37.js.gz +0 -0
- package/dist/chunk-IRG7SIUX.js.br +0 -0
- package/dist/chunk-IRG7SIUX.js.gz +0 -0
- package/dist/chunk-IXKAIIA2.mjs.br +0 -0
- package/dist/chunk-IXKAIIA2.mjs.gz +0 -0
- package/dist/chunk-KVXB22D3.js.br +0 -0
- package/dist/chunk-KVXB22D3.js.gz +0 -0
- package/dist/chunk-LAU34UMB.mjs.br +0 -0
- package/dist/chunk-OAKDJYYT.mjs.br +0 -0
- package/dist/chunk-OAKDJYYT.mjs.gz +0 -0
- package/dist/chunk-QTGCOL5H.mjs.br +0 -0
- package/dist/chunk-QTGCOL5H.mjs.gz +0 -0
- package/dist/chunk-VYSMTC5C.mjs.br +0 -0
- package/dist/chunk-VYSMTC5C.mjs.gz +0 -0
- package/dist/chunk-XBMKFZVP.mjs.br +0 -0
- package/dist/chunk-XBMKFZVP.mjs.gz +0 -0
- package/dist/three.module-AC7ESV4W.mjs +0 -2
- package/dist/three.module-AC7ESV4W.mjs.br +0 -0
- package/dist/three.module-AC7ESV4W.mjs.gz +0 -0
- package/dist/three.module-GNNNRIMK.js.br +0 -0
- package/dist/three.module-GNNNRIMK.js.gz +0 -0
- package/dist/useViewerBuildingBlocks-DkUGmlkP.d.ts.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkLJ46KXUV_js = require('./chunk-LJ46KXUV.js');
|
|
4
|
+
var chunkV32F4I45_js = require('./chunk-V32F4I45.js');
|
|
5
|
+
var chunkBRJN3ZMG_js = require('./chunk-BRJN3ZMG.js');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var reactI18next = require('react-i18next');
|
|
8
8
|
|
|
9
9
|
function useVirtualizedSlides({
|
|
10
10
|
totalItems,
|
|
11
11
|
itemHeight,
|
|
12
|
-
overscan =
|
|
12
|
+
overscan = chunkV32F4I45_js.DEFAULT_VIRTUAL_OVERSCAN
|
|
13
13
|
}) {
|
|
14
14
|
const scrollContainerRef = react.useRef(null);
|
|
15
15
|
const [scrollTop, setScrollTop] = react.useState(0);
|
|
@@ -39,7 +39,7 @@ function useVirtualizedSlides({
|
|
|
39
39
|
resizeObserver?.disconnect();
|
|
40
40
|
};
|
|
41
41
|
}, []);
|
|
42
|
-
const range =
|
|
42
|
+
const range = chunkV32F4I45_js.computeVirtualRange(totalItems, itemHeight, scrollTop, viewportHeight, overscan);
|
|
43
43
|
const safeItemHeight = Math.max(itemHeight, 1);
|
|
44
44
|
const scrollToIndex = react.useCallback(
|
|
45
45
|
(index, behavior = "smooth") => {
|
|
@@ -80,7 +80,7 @@ function usePresenceTracking({
|
|
|
80
80
|
}) {
|
|
81
81
|
const [remoteUsers, setRemoteUsers] = react.useState([]);
|
|
82
82
|
const projectorRef = react.useRef(null);
|
|
83
|
-
projectorRef.current ??=
|
|
83
|
+
projectorRef.current ??= chunkV32F4I45_js.createPresenceProjector();
|
|
84
84
|
const projector = projectorRef.current;
|
|
85
85
|
const lastBroadcastRef = react.useRef(0);
|
|
86
86
|
const pendingBroadcastRef = react.useRef(null);
|
|
@@ -105,7 +105,7 @@ function usePresenceTracking({
|
|
|
105
105
|
awareness.setLocalStateField("presence", state);
|
|
106
106
|
lastBroadcastRef.current = Date.now();
|
|
107
107
|
};
|
|
108
|
-
if (elapsed >=
|
|
108
|
+
if (elapsed >= chunkV32F4I45_js.BROADCAST_THROTTLE_MS) {
|
|
109
109
|
if (pendingBroadcastRef.current) {
|
|
110
110
|
clearTimeout(pendingBroadcastRef.current);
|
|
111
111
|
pendingBroadcastRef.current = null;
|
|
@@ -115,7 +115,7 @@ function usePresenceTracking({
|
|
|
115
115
|
pendingBroadcastRef.current = setTimeout(() => {
|
|
116
116
|
pendingBroadcastRef.current = null;
|
|
117
117
|
flush();
|
|
118
|
-
},
|
|
118
|
+
}, chunkV32F4I45_js.BROADCAST_THROTTLE_MS - elapsed);
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
[awareness, userName, userColor, userAvatar, role]
|
|
@@ -195,7 +195,7 @@ function useYjsProvider({ config }) {
|
|
|
195
195
|
const departureRef = react.useRef(null);
|
|
196
196
|
const gateRef = react.useRef(null);
|
|
197
197
|
if (!gateRef.current) {
|
|
198
|
-
gateRef.current =
|
|
198
|
+
gateRef.current = chunkV32F4I45_js.createSyncGate(() => setSynced(true));
|
|
199
199
|
}
|
|
200
200
|
const teardown = react.useCallback(() => {
|
|
201
201
|
if (timeoutRef.current) {
|
|
@@ -215,7 +215,7 @@ function useYjsProvider({ config }) {
|
|
|
215
215
|
const buildCleanup = react.useCallback(
|
|
216
216
|
(provider, yDoc) => () => {
|
|
217
217
|
announceDeparture();
|
|
218
|
-
|
|
218
|
+
chunkV32F4I45_js.clearLocalAwareness(provider.awareness);
|
|
219
219
|
provider.destroy();
|
|
220
220
|
yDoc.destroy();
|
|
221
221
|
setDoc(null);
|
|
@@ -240,9 +240,9 @@ function useYjsProvider({ config }) {
|
|
|
240
240
|
if (config.authToken) {
|
|
241
241
|
opts.password = config.authToken;
|
|
242
242
|
}
|
|
243
|
-
const roomId =
|
|
243
|
+
const roomId = chunkV32F4I45_js.validateRoomId(config.roomId);
|
|
244
244
|
const provider = new WebrtcProvider(roomId, yDoc, opts);
|
|
245
|
-
departureRef.current =
|
|
245
|
+
departureRef.current = chunkV32F4I45_js.createDepartureChannel(roomId, provider.awareness);
|
|
246
246
|
setDoc(yDoc);
|
|
247
247
|
setAwareness(provider.awareness);
|
|
248
248
|
setClientId(provider.awareness.clientID);
|
|
@@ -284,13 +284,13 @@ function useYjsProvider({ config }) {
|
|
|
284
284
|
if (!config) {
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
const roomId =
|
|
288
|
-
const transport = config.transport ??
|
|
287
|
+
const roomId = chunkV32F4I45_js.validateRoomId(config.roomId);
|
|
288
|
+
const transport = config.transport ?? chunkV32F4I45_js.resolveTransportForServerUrl(config.serverUrl);
|
|
289
289
|
if (transport === "webrtc") {
|
|
290
290
|
await initWebrtc();
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
|
-
if (
|
|
293
|
+
if (chunkV32F4I45_js.isMixedContentBlocked(config.serverUrl)) {
|
|
294
294
|
console.warn(
|
|
295
295
|
`[pptx-viewer] Refusing to connect: insecure ws:// server "${config.serverUrl}" is blocked from a secure (https) page. Use a wss:// URL.`
|
|
296
296
|
);
|
|
@@ -304,7 +304,7 @@ function useYjsProvider({ config }) {
|
|
|
304
304
|
const provider = new WebsocketProvider(config.serverUrl, roomId, yDoc, {
|
|
305
305
|
params: config.authToken ? { token: config.authToken } : void 0
|
|
306
306
|
});
|
|
307
|
-
departureRef.current =
|
|
307
|
+
departureRef.current = chunkV32F4I45_js.createDepartureChannel(roomId, provider.awareness);
|
|
308
308
|
let connected = false;
|
|
309
309
|
const handleStatus = (event) => {
|
|
310
310
|
if (event.status === "connected") {
|
|
@@ -344,7 +344,7 @@ function useYjsProvider({ config }) {
|
|
|
344
344
|
provider.off("status", handleStatus);
|
|
345
345
|
provider.off("sync", handleSynced);
|
|
346
346
|
announceDeparture();
|
|
347
|
-
|
|
347
|
+
chunkV32F4I45_js.clearLocalAwareness(provider.awareness);
|
|
348
348
|
provider.destroy();
|
|
349
349
|
yDoc.destroy();
|
|
350
350
|
setDoc(null);
|
|
@@ -353,7 +353,7 @@ function useYjsProvider({ config }) {
|
|
|
353
353
|
cleanupRef.current = null;
|
|
354
354
|
setStatus("error");
|
|
355
355
|
}
|
|
356
|
-
},
|
|
356
|
+
}, chunkV32F4I45_js.CONNECTION_TIMEOUT_MS);
|
|
357
357
|
}
|
|
358
358
|
setDoc(yDoc);
|
|
359
359
|
setAwareness(provider.awareness);
|
|
@@ -362,7 +362,7 @@ function useYjsProvider({ config }) {
|
|
|
362
362
|
provider.off("status", handleStatus);
|
|
363
363
|
provider.off("sync", handleSynced);
|
|
364
364
|
announceDeparture();
|
|
365
|
-
|
|
365
|
+
chunkV32F4I45_js.clearLocalAwareness(provider.awareness);
|
|
366
366
|
provider.destroy();
|
|
367
367
|
yDoc.destroy();
|
|
368
368
|
setDoc(null);
|
|
@@ -388,7 +388,7 @@ function useYjsProvider({ config }) {
|
|
|
388
388
|
]);
|
|
389
389
|
react.useEffect(() => {
|
|
390
390
|
init();
|
|
391
|
-
const disposeTeardown =
|
|
391
|
+
const disposeTeardown = chunkV32F4I45_js.registerCollaborationTeardown({
|
|
392
392
|
leave: teardown,
|
|
393
393
|
rejoin: init
|
|
394
394
|
});
|
|
@@ -409,7 +409,7 @@ function useCollaborativeState({
|
|
|
409
409
|
canvasWidth,
|
|
410
410
|
canvasHeight
|
|
411
411
|
}) {
|
|
412
|
-
const userColor =
|
|
412
|
+
const userColor = chunkV32F4I45_js.sanitizeColor(config?.userColor, "#6366f1");
|
|
413
413
|
const { status, awareness, doc, clientId, synced, retry } = useYjsProvider({ config });
|
|
414
414
|
const { remoteUsers, broadcastPresence } = usePresenceTracking({
|
|
415
415
|
awareness,
|
|
@@ -473,6 +473,40 @@ function useSheetDismissDrag(onClose, threshold = 120) {
|
|
|
473
473
|
handlers: { onPointerDown, onPointerMove, onPointerUp, onPointerCancel: onPointerUp }
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
|
+
var POLL_INTERVAL_MS = 16;
|
|
477
|
+
function usePointerReleaseWakeup(hasActivePointerInteraction) {
|
|
478
|
+
const [pointerReleaseNonce, setPointerReleaseNonce] = react.useState(0);
|
|
479
|
+
const gateRef = react.useRef(hasActivePointerInteraction);
|
|
480
|
+
const timerRef = react.useRef(null);
|
|
481
|
+
react.useEffect(() => {
|
|
482
|
+
gateRef.current = hasActivePointerInteraction;
|
|
483
|
+
}, [hasActivePointerInteraction]);
|
|
484
|
+
const deferUntilPointerReleased = react.useCallback(() => {
|
|
485
|
+
if (timerRef.current !== null) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const poll = () => {
|
|
489
|
+
if (gateRef.current()) {
|
|
490
|
+
timerRef.current = setTimeout(poll, POLL_INTERVAL_MS);
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
timerRef.current = null;
|
|
494
|
+
setPointerReleaseNonce((previous) => previous + 1);
|
|
495
|
+
};
|
|
496
|
+
timerRef.current = setTimeout(poll, POLL_INTERVAL_MS);
|
|
497
|
+
}, []);
|
|
498
|
+
react.useEffect(() => {
|
|
499
|
+
return () => {
|
|
500
|
+
if (timerRef.current !== null) {
|
|
501
|
+
clearTimeout(timerRef.current);
|
|
502
|
+
timerRef.current = null;
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}, []);
|
|
506
|
+
return { pointerReleaseNonce, deferUntilPointerReleased };
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// src/viewer/hooks/useEditorHistory.ts
|
|
476
510
|
var DEFAULT_MAX_HISTORY_ENTRIES = 120;
|
|
477
511
|
function serializeDocument(snapshot) {
|
|
478
512
|
return JSON.stringify({
|
|
@@ -513,6 +547,9 @@ function useEditorHistory(input) {
|
|
|
513
547
|
const [undoLabel, setUndoLabel] = react.useState(void 0);
|
|
514
548
|
const [redoLabel, setRedoLabel] = react.useState(void 0);
|
|
515
549
|
const [editCommitNonce, setEditCommitNonce] = react.useState(0);
|
|
550
|
+
const { pointerReleaseNonce, deferUntilPointerReleased } = usePointerReleaseWakeup(
|
|
551
|
+
hasActivePointerInteraction
|
|
552
|
+
);
|
|
516
553
|
const updateHistoryAvailability = react.useCallback(() => {
|
|
517
554
|
setCanUndo(historyPastRef.current.length > 0);
|
|
518
555
|
setCanRedo(historyFutureRef.current.length > 0);
|
|
@@ -527,8 +564,8 @@ function useEditorHistory(input) {
|
|
|
527
564
|
width: canvasSize.width,
|
|
528
565
|
height: canvasSize.height,
|
|
529
566
|
activeSlideIndex,
|
|
530
|
-
slides: slides.map(
|
|
531
|
-
templateElementsBySlideId:
|
|
567
|
+
slides: slides.map(chunkV32F4I45_js.cloneSlide),
|
|
568
|
+
templateElementsBySlideId: chunkV32F4I45_js.cloneTemplateElementsBySlideId(templateElementsBySlideId),
|
|
532
569
|
...actionLabel ? { actionLabel } : {}
|
|
533
570
|
};
|
|
534
571
|
},
|
|
@@ -541,9 +578,9 @@ function useEditorHistory(input) {
|
|
|
541
578
|
width: snapshot.width,
|
|
542
579
|
height: snapshot.height
|
|
543
580
|
});
|
|
544
|
-
setSlides(snapshot.slides.map(
|
|
581
|
+
setSlides(snapshot.slides.map(chunkV32F4I45_js.cloneSlide));
|
|
545
582
|
setTemplateElementsBySlideId(
|
|
546
|
-
|
|
583
|
+
chunkV32F4I45_js.cloneTemplateElementsBySlideId(snapshot.templateElementsBySlideId)
|
|
547
584
|
);
|
|
548
585
|
setActiveSlideIndex(Math.min(snapshot.activeSlideIndex, maxSlideIndex));
|
|
549
586
|
setSelectedElementIds([]);
|
|
@@ -582,8 +619,8 @@ function useEditorHistory(input) {
|
|
|
582
619
|
const currentSnapshot = buildHistorySnapshot();
|
|
583
620
|
historyFutureRef.current.push(currentSnapshot);
|
|
584
621
|
isApplyingHistoryRef.current = true;
|
|
585
|
-
const nextSnapshot =
|
|
586
|
-
lastHistorySnapshotRef.current =
|
|
622
|
+
const nextSnapshot = chunkLJ46KXUV_js.cloneHistorySnapshot(previousSnapshot);
|
|
623
|
+
lastHistorySnapshotRef.current = chunkLJ46KXUV_js.cloneHistorySnapshot(nextSnapshot);
|
|
587
624
|
lastHistorySerializedRef.current = serializeDocument(nextSnapshot);
|
|
588
625
|
applyHistorySnapshot(nextSnapshot);
|
|
589
626
|
updateHistoryAvailability();
|
|
@@ -604,8 +641,8 @@ function useEditorHistory(input) {
|
|
|
604
641
|
const currentSnapshot = buildHistorySnapshot();
|
|
605
642
|
historyPastRef.current.push(currentSnapshot);
|
|
606
643
|
isApplyingHistoryRef.current = true;
|
|
607
|
-
const targetSnapshot =
|
|
608
|
-
lastHistorySnapshotRef.current =
|
|
644
|
+
const targetSnapshot = chunkLJ46KXUV_js.cloneHistorySnapshot(nextSnapshot);
|
|
645
|
+
lastHistorySnapshotRef.current = chunkLJ46KXUV_js.cloneHistorySnapshot(targetSnapshot);
|
|
609
646
|
lastHistorySerializedRef.current = serializeDocument(targetSnapshot);
|
|
610
647
|
applyHistorySnapshot(targetSnapshot);
|
|
611
648
|
updateHistoryAvailability();
|
|
@@ -623,7 +660,7 @@ function useEditorHistory(input) {
|
|
|
623
660
|
historyPastRef.current = [];
|
|
624
661
|
historyFutureRef.current = [];
|
|
625
662
|
if (initialSnapshot) {
|
|
626
|
-
const clonedInitial =
|
|
663
|
+
const clonedInitial = chunkLJ46KXUV_js.cloneHistorySnapshot(initialSnapshot);
|
|
627
664
|
lastHistorySnapshotRef.current = clonedInitial;
|
|
628
665
|
lastHistorySerializedRef.current = serializeDocument(clonedInitial);
|
|
629
666
|
} else {
|
|
@@ -650,9 +687,10 @@ function useEditorHistory(input) {
|
|
|
650
687
|
return;
|
|
651
688
|
}
|
|
652
689
|
if (hasActivePointerInteraction()) {
|
|
690
|
+
deferUntilPointerReleased();
|
|
653
691
|
return;
|
|
654
692
|
}
|
|
655
|
-
const cheapHash = `${pointerCommitNonce}|${editCommitNonce}|${slides.length}|${activeSlideIndex}|${canvasSize.width}x${canvasSize.height}|${slides.map((s) => `${s.id}:${s.elements.length}`).join("/")}`;
|
|
693
|
+
const cheapHash = `${pointerCommitNonce}|${editCommitNonce}|${pointerReleaseNonce}|${slides.length}|${activeSlideIndex}|${canvasSize.width}x${canvasSize.height}|${slides.map((s) => `${s.id}:${s.elements.length}`).join("/")}`;
|
|
656
694
|
if (cheapHash === lastCheapHashRef.current) {
|
|
657
695
|
return;
|
|
658
696
|
}
|
|
@@ -671,19 +709,19 @@ function useEditorHistory(input) {
|
|
|
671
709
|
}
|
|
672
710
|
const previousSnapshot = lastHistorySnapshotRef.current;
|
|
673
711
|
if (!previousSnapshot) {
|
|
674
|
-
lastHistorySnapshotRef.current =
|
|
712
|
+
lastHistorySnapshotRef.current = chunkLJ46KXUV_js.cloneHistorySnapshot(snapshot);
|
|
675
713
|
lastHistorySerializedRef.current = serialized;
|
|
676
714
|
lastCheapHashRef.current = cheapHash;
|
|
677
715
|
updateHistoryAvailability();
|
|
678
716
|
return;
|
|
679
717
|
}
|
|
680
718
|
onDirtyRef.current?.();
|
|
681
|
-
historyPastRef.current.push(
|
|
719
|
+
historyPastRef.current.push(chunkLJ46KXUV_js.cloneHistorySnapshot(previousSnapshot));
|
|
682
720
|
while (historyPastRef.current.length > Math.max(1, maxHistoryEntries)) {
|
|
683
721
|
historyPastRef.current.shift();
|
|
684
722
|
}
|
|
685
723
|
historyFutureRef.current = [];
|
|
686
|
-
lastHistorySnapshotRef.current =
|
|
724
|
+
lastHistorySnapshotRef.current = chunkLJ46KXUV_js.cloneHistorySnapshot(snapshot);
|
|
687
725
|
lastHistorySerializedRef.current = serialized;
|
|
688
726
|
lastCheapHashRef.current = cheapHash;
|
|
689
727
|
updateHistoryAvailability();
|
|
@@ -692,12 +730,14 @@ function useEditorHistory(input) {
|
|
|
692
730
|
buildHistorySnapshot,
|
|
693
731
|
canvasSize.height,
|
|
694
732
|
canvasSize.width,
|
|
733
|
+
deferUntilPointerReleased,
|
|
695
734
|
editCommitNonce,
|
|
696
735
|
error,
|
|
697
736
|
hasActivePointerInteraction,
|
|
698
737
|
loading,
|
|
699
738
|
maxHistoryEntries,
|
|
700
739
|
pointerCommitNonce,
|
|
740
|
+
pointerReleaseNonce,
|
|
701
741
|
slides,
|
|
702
742
|
updateHistoryAvailability
|
|
703
743
|
]);
|
|
@@ -735,10 +775,10 @@ function useViewerStore(store, selector, isEqual = Object.is) {
|
|
|
735
775
|
var DEFAULT_FIT = { fitPadding: { horizontal: 4, vertical: 16 }, maxFitScale: 1 };
|
|
736
776
|
function useViewportFit(canvasSize, viewportRef, options) {
|
|
737
777
|
const [editorDimensions, setEditorDimensions] = react.useState(null);
|
|
738
|
-
const { fitPadding, maxFitScale } =
|
|
778
|
+
const { fitPadding, maxFitScale } = chunkV32F4I45_js.resolveViewportFitOptions(options, DEFAULT_FIT);
|
|
739
779
|
const { horizontal, vertical } = fitPadding;
|
|
740
780
|
const effectiveEditorDimensions = editorDimensions ?? canvasSize;
|
|
741
|
-
const { scale: fitScale } =
|
|
781
|
+
const { scale: fitScale } = chunkV32F4I45_js.calculateViewportFit({
|
|
742
782
|
viewportWidth: effectiveEditorDimensions.width,
|
|
743
783
|
viewportHeight: effectiveEditorDimensions.height,
|
|
744
784
|
canvasWidth: canvasSize.width,
|
|
@@ -749,7 +789,7 @@ function useViewportFit(canvasSize, viewportRef, options) {
|
|
|
749
789
|
let observer = null;
|
|
750
790
|
let raf = 0;
|
|
751
791
|
const measure = (element) => {
|
|
752
|
-
const { availableWidth: width, availableHeight: height } =
|
|
792
|
+
const { availableWidth: width, availableHeight: height } = chunkV32F4I45_js.calculateViewportFit({
|
|
753
793
|
viewportWidth: element.clientWidth,
|
|
754
794
|
viewportHeight: element.clientHeight,
|
|
755
795
|
canvasWidth: canvasSize.width,
|
|
@@ -791,9 +831,9 @@ function useZoomViewport({
|
|
|
791
831
|
const canvasStageRef = react.useRef(null);
|
|
792
832
|
const canvasViewportRef = react.useRef(null);
|
|
793
833
|
const renderScaleRef = react.useRef(1);
|
|
794
|
-
const wheelBufferRef = react.useRef(
|
|
834
|
+
const wheelBufferRef = react.useRef(chunkV32F4I45_js.createWheelStepBuffer());
|
|
795
835
|
const storeRef = react.useRef(null);
|
|
796
|
-
storeRef.current ??=
|
|
836
|
+
storeRef.current ??= chunkV32F4I45_js.createViewerZoomStore();
|
|
797
837
|
const store = storeRef.current;
|
|
798
838
|
const scale = useViewerStore(store, selectZoom);
|
|
799
839
|
const setScale = react.useCallback(
|
|
@@ -815,7 +855,7 @@ function useZoomViewport({
|
|
|
815
855
|
if (!wrapper || !canvasViewport) {
|
|
816
856
|
return;
|
|
817
857
|
}
|
|
818
|
-
const boundedScale =
|
|
858
|
+
const boundedScale = chunkV32F4I45_js.clampZoomScale(nextScale);
|
|
819
859
|
const nextEditorScale = fitScale * boundedScale;
|
|
820
860
|
const centerX = (bounds.minX + bounds.maxX) / 2;
|
|
821
861
|
const centerY = (bounds.minY + bounds.maxY) / 2;
|
|
@@ -852,29 +892,29 @@ function useZoomViewport({
|
|
|
852
892
|
selectedElements.forEach((element) => {
|
|
853
893
|
minX = Math.min(minX, element.x);
|
|
854
894
|
minY = Math.min(minY, element.y);
|
|
855
|
-
maxX = Math.max(maxX, element.x + Math.max(element.width,
|
|
856
|
-
maxY = Math.max(maxY, element.y + Math.max(element.height,
|
|
895
|
+
maxX = Math.max(maxX, element.x + Math.max(element.width, chunkLJ46KXUV_js.MIN_ELEMENT_SIZE));
|
|
896
|
+
maxY = Math.max(maxY, element.y + Math.max(element.height, chunkLJ46KXUV_js.MIN_ELEMENT_SIZE));
|
|
857
897
|
});
|
|
858
898
|
if (!Number.isFinite(minX) || !Number.isFinite(minY) || !Number.isFinite(maxX) || !Number.isFinite(maxY)) {
|
|
859
899
|
return;
|
|
860
900
|
}
|
|
861
901
|
const selectionBounds = { minX, minY, maxX, maxY };
|
|
862
|
-
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX,
|
|
863
|
-
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY,
|
|
902
|
+
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX, chunkLJ46KXUV_js.MIN_ELEMENT_SIZE);
|
|
903
|
+
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY, chunkLJ46KXUV_js.MIN_ELEMENT_SIZE);
|
|
864
904
|
const availableWidth = Math.max(
|
|
865
|
-
effectiveEditorDimensions.width -
|
|
866
|
-
|
|
905
|
+
effectiveEditorDimensions.width - chunkLJ46KXUV_js.ZOOM_TO_SELECTION_PADDING,
|
|
906
|
+
chunkLJ46KXUV_js.MIN_ELEMENT_SIZE
|
|
867
907
|
);
|
|
868
908
|
const availableHeight = Math.max(
|
|
869
|
-
effectiveEditorDimensions.height -
|
|
870
|
-
|
|
909
|
+
effectiveEditorDimensions.height - chunkLJ46KXUV_js.ZOOM_TO_SELECTION_PADDING,
|
|
910
|
+
chunkLJ46KXUV_js.MIN_ELEMENT_SIZE
|
|
871
911
|
);
|
|
872
912
|
const targetEditorScale = Math.min(
|
|
873
913
|
availableWidth / boundsWidth,
|
|
874
914
|
availableHeight / boundsHeight
|
|
875
915
|
);
|
|
876
916
|
const safeFitScale = fitScale > Number.EPSILON ? fitScale : Number.EPSILON;
|
|
877
|
-
const nextScale =
|
|
917
|
+
const nextScale = chunkV32F4I45_js.clampZoomScale(targetEditorScale / safeFitScale);
|
|
878
918
|
setScale(nextScale);
|
|
879
919
|
window.requestAnimationFrame(() => {
|
|
880
920
|
window.requestAnimationFrame(() => {
|
|
@@ -891,14 +931,14 @@ function useZoomViewport({
|
|
|
891
931
|
]);
|
|
892
932
|
const handleWheel = react.useCallback(
|
|
893
933
|
(event) => {
|
|
894
|
-
const mapped =
|
|
934
|
+
const mapped = chunkV32F4I45_js.mapEditingWheel(event, wheelBufferRef.current, true);
|
|
895
935
|
if (mapped.intent !== "zoom") {
|
|
896
936
|
return;
|
|
897
937
|
}
|
|
898
938
|
event.preventDefault();
|
|
899
939
|
store.dispatch({
|
|
900
940
|
type: "set-zoom",
|
|
901
|
-
zoom:
|
|
941
|
+
zoom: chunkV32F4I45_js.clampZoomScale(store.getState().zoom + mapped.deltaScale)
|
|
902
942
|
});
|
|
903
943
|
},
|
|
904
944
|
[store]
|
|
@@ -993,8 +1033,8 @@ function scheduleOpeningAutoPlayGroup(controller, ctx) {
|
|
|
993
1033
|
if (!group) {
|
|
994
1034
|
return;
|
|
995
1035
|
}
|
|
996
|
-
|
|
997
|
-
|
|
1036
|
+
chunkV32F4I45_js.playGroup(controller, group, ctx);
|
|
1037
|
+
chunkV32F4I45_js.scheduleAutoAdvanceChain(controller, ctx);
|
|
998
1038
|
}, firstGroup.autoAdvanceDelayMs ?? 0);
|
|
999
1039
|
ctx.timers.push(timer);
|
|
1000
1040
|
}
|
|
@@ -1013,7 +1053,7 @@ function scheduleEntranceAnimationTimers(slide, setPresentationAnimations, prese
|
|
|
1013
1053
|
}))
|
|
1014
1054
|
);
|
|
1015
1055
|
entranceAnimations.forEach((animation, animationIndex) => {
|
|
1016
|
-
const delay =
|
|
1056
|
+
const delay = chunkV32F4I45_js.computeEntranceAnimationDelay(animation.delayMs, animationIndex);
|
|
1017
1057
|
const timer = window.setTimeout(() => {
|
|
1018
1058
|
setPresentationAnimations(
|
|
1019
1059
|
(previousAnimations) => previousAnimations.map(
|
|
@@ -1046,7 +1086,7 @@ function useAnimationPlayback(input) {
|
|
|
1046
1086
|
const presentationTimersRef = react.useRef([]);
|
|
1047
1087
|
const controllerRef = react.useRef(null);
|
|
1048
1088
|
const buildRafRef = react.useRef(null);
|
|
1049
|
-
const activeAnimationGroupRef = react.useRef(
|
|
1089
|
+
const activeAnimationGroupRef = react.useRef(chunkV32F4I45_js.createActiveAnimationGroup());
|
|
1050
1090
|
const seededCompletedRef = react.useRef(false);
|
|
1051
1091
|
const mediaTimeNodeElementIdsRef = react.useRef(/* @__PURE__ */ new Map());
|
|
1052
1092
|
const lastSeedCompletedRef = react.useRef(false);
|
|
@@ -1063,15 +1103,15 @@ function useAnimationPlayback(input) {
|
|
|
1063
1103
|
}, [onPlayActionSound]);
|
|
1064
1104
|
react.useEffect(() => {
|
|
1065
1105
|
return () => {
|
|
1066
|
-
|
|
1106
|
+
chunkV32F4I45_js.cancelBuildReveal(buildRafRef);
|
|
1067
1107
|
};
|
|
1068
1108
|
}, []);
|
|
1069
1109
|
const clearPresentationTimers = react.useCallback(() => {
|
|
1070
|
-
|
|
1110
|
+
chunkV32F4I45_js.clearPlaybackTimers(buildPlaybackContext(), activeAnimationGroupRef.current);
|
|
1071
1111
|
}, [buildPlaybackContext]);
|
|
1072
1112
|
const resetSlideTimeline = react.useCallback(
|
|
1073
1113
|
(slideIndex) => {
|
|
1074
|
-
|
|
1114
|
+
chunkV32F4I45_js.cancelBuildReveal(buildRafRef);
|
|
1075
1115
|
const slide = slides[slideIndex];
|
|
1076
1116
|
if (!slide) {
|
|
1077
1117
|
controllerRef.current = null;
|
|
@@ -1082,14 +1122,14 @@ function useAnimationPlayback(input) {
|
|
|
1082
1122
|
setHoverTriggerShapeIds(/* @__PURE__ */ new Set());
|
|
1083
1123
|
return;
|
|
1084
1124
|
}
|
|
1085
|
-
const controller =
|
|
1125
|
+
const controller = chunkV32F4I45_js.PresentationAnimationController.fromSlide(slide, {
|
|
1086
1126
|
slideHeightPx: canvasSize?.height,
|
|
1087
1127
|
slideWidthPx: canvasSize?.width,
|
|
1088
1128
|
themeColorMap,
|
|
1089
1129
|
pixelateMosaic: pixelateMosaicAnimation
|
|
1090
1130
|
});
|
|
1091
1131
|
controllerRef.current = controller;
|
|
1092
|
-
mediaTimeNodeElementIdsRef.current =
|
|
1132
|
+
mediaTimeNodeElementIdsRef.current = chunkV32F4I45_js.resolveMediaTimeNodeElementIds(
|
|
1093
1133
|
slide.nativeAnimations ?? []
|
|
1094
1134
|
);
|
|
1095
1135
|
setPresentationKeyframesCss(controller.keyframesCss);
|
|
@@ -1103,7 +1143,7 @@ function useAnimationPlayback(input) {
|
|
|
1103
1143
|
if (!animationsEnabled) {
|
|
1104
1144
|
return false;
|
|
1105
1145
|
}
|
|
1106
|
-
return
|
|
1146
|
+
return chunkV32F4I45_js.advanceMainSequence(
|
|
1107
1147
|
controllerRef.current,
|
|
1108
1148
|
buildPlaybackContext(),
|
|
1109
1149
|
activeAnimationGroupRef.current
|
|
@@ -1119,7 +1159,7 @@ function useAnimationPlayback(input) {
|
|
|
1119
1159
|
if (!group) {
|
|
1120
1160
|
return false;
|
|
1121
1161
|
}
|
|
1122
|
-
|
|
1162
|
+
chunkV32F4I45_js.playGroup(controller, group, buildPlaybackContext());
|
|
1123
1163
|
return true;
|
|
1124
1164
|
},
|
|
1125
1165
|
[buildPlaybackContext]
|
|
@@ -1138,7 +1178,7 @@ function useAnimationPlayback(input) {
|
|
|
1138
1178
|
if (!group) {
|
|
1139
1179
|
return false;
|
|
1140
1180
|
}
|
|
1141
|
-
|
|
1181
|
+
chunkV32F4I45_js.playGroup(controller, group, buildPlaybackContext());
|
|
1142
1182
|
return true;
|
|
1143
1183
|
},
|
|
1144
1184
|
[animationsEnabled, buildPlaybackContext]
|
|
@@ -1219,12 +1259,12 @@ function useAnimationPlayback(input) {
|
|
|
1219
1259
|
presentationTimersRef
|
|
1220
1260
|
};
|
|
1221
1261
|
}
|
|
1222
|
-
var PRESENTER_CHANNEL_NAME =
|
|
1223
|
-
var AUDIENCE_HASH =
|
|
1224
|
-
var PRESENTER_MSG_ORIGIN =
|
|
1225
|
-
var AUDIENCE_NONCE_KEY =
|
|
1262
|
+
var PRESENTER_CHANNEL_NAME = chunkV32F4I45_js.PRESENTATION_CHANNEL_NAME;
|
|
1263
|
+
var AUDIENCE_HASH = chunkV32F4I45_js.PRESENTATION_HASH;
|
|
1264
|
+
var PRESENTER_MSG_ORIGIN = chunkV32F4I45_js.PRESENTATION_MESSAGE_ORIGIN;
|
|
1265
|
+
var AUDIENCE_NONCE_KEY = chunkV32F4I45_js.PRESENTATION_NONCE_KEY;
|
|
1226
1266
|
function generateSessionId() {
|
|
1227
|
-
return
|
|
1267
|
+
return chunkV32F4I45_js.createPresentationSessionId();
|
|
1228
1268
|
}
|
|
1229
1269
|
function parseAudienceNonce() {
|
|
1230
1270
|
const hash = window.location.hash;
|
|
@@ -1260,7 +1300,7 @@ function usePresenterWindow(input) {
|
|
|
1260
1300
|
}, []);
|
|
1261
1301
|
const swapDisplays = react.useCallback(async () => {
|
|
1262
1302
|
const audience = audienceWindowRef.current;
|
|
1263
|
-
return audience && !audience.closed ?
|
|
1303
|
+
return audience && !audience.closed ? chunkV32F4I45_js.swapPresentationWindows(window, audience) : false;
|
|
1264
1304
|
}, []);
|
|
1265
1305
|
const syncSlideToAudience = react.useCallback(
|
|
1266
1306
|
(slideIndex) => {
|
|
@@ -1324,7 +1364,7 @@ function usePresenterWindow(input) {
|
|
|
1324
1364
|
pollTimerRef.current = null;
|
|
1325
1365
|
}
|
|
1326
1366
|
if (closingSessionId) {
|
|
1327
|
-
void
|
|
1367
|
+
void chunkV32F4I45_js.clearAudienceContent(closingSessionId);
|
|
1328
1368
|
}
|
|
1329
1369
|
}, [getChannel]);
|
|
1330
1370
|
const openAudienceWindow = react.useCallback(() => {
|
|
@@ -1342,10 +1382,10 @@ function usePresenterWindow(input) {
|
|
|
1342
1382
|
audienceWindowRef.current = blankWin;
|
|
1343
1383
|
const sessionId = generateSessionId();
|
|
1344
1384
|
sessionIdRef.current = sessionId;
|
|
1345
|
-
const audienceUrl =
|
|
1346
|
-
void
|
|
1385
|
+
const audienceUrl = chunkV32F4I45_js.buildPresentationAudienceUrl(window.location.href, sessionId);
|
|
1386
|
+
void chunkV32F4I45_js.resolveAudienceScreenPlacement(window).then((placement) => {
|
|
1347
1387
|
if (placement && audienceWindowRef.current === blankWin && !blankWin.closed) {
|
|
1348
|
-
|
|
1388
|
+
chunkV32F4I45_js.placeAudienceWindow(blankWin, placement);
|
|
1349
1389
|
}
|
|
1350
1390
|
return void 0;
|
|
1351
1391
|
});
|
|
@@ -1375,7 +1415,7 @@ function usePresenterWindow(input) {
|
|
|
1375
1415
|
}
|
|
1376
1416
|
};
|
|
1377
1417
|
if (content) {
|
|
1378
|
-
void
|
|
1418
|
+
void chunkV32F4I45_js.storeAudienceContent(content, sessionId).then(() => navigateOrClose(true)).catch(() => navigateOrClose(false));
|
|
1379
1419
|
} else {
|
|
1380
1420
|
navigateOrClose(true);
|
|
1381
1421
|
}
|
|
@@ -1401,7 +1441,7 @@ function usePresenterWindow(input) {
|
|
|
1401
1441
|
}
|
|
1402
1442
|
const handleMessage = (event) => {
|
|
1403
1443
|
const message = event.data;
|
|
1404
|
-
if (
|
|
1444
|
+
if (chunkV32F4I45_js.isPresentationSessionMessage(message) && message.type === "audience-ready" && message.sessionId === sessionIdRef.current) {
|
|
1405
1445
|
syncStateToAudience(snapshotRef.current);
|
|
1406
1446
|
}
|
|
1407
1447
|
};
|
|
@@ -1430,7 +1470,7 @@ function usePresenterWindow(input) {
|
|
|
1430
1470
|
react.useEffect(() => {
|
|
1431
1471
|
const handleBeforeUnload = () => {
|
|
1432
1472
|
if (sessionIdRef.current) {
|
|
1433
|
-
void
|
|
1473
|
+
void chunkV32F4I45_js.clearAudienceContent(sessionIdRef.current);
|
|
1434
1474
|
}
|
|
1435
1475
|
};
|
|
1436
1476
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
@@ -1492,7 +1532,7 @@ function useAudienceMode(input) {
|
|
|
1492
1532
|
}
|
|
1493
1533
|
channel.onmessage = (event) => {
|
|
1494
1534
|
const data = event.data;
|
|
1495
|
-
if (!
|
|
1535
|
+
if (!chunkV32F4I45_js.isPresentationSessionMessage(data) || data.origin !== PRESENTER_MSG_ORIGIN) {
|
|
1496
1536
|
return;
|
|
1497
1537
|
}
|
|
1498
1538
|
if (expectedSessionId && data.sessionId !== expectedSessionId) {
|
|
@@ -1508,16 +1548,16 @@ function useAudienceMode(input) {
|
|
|
1508
1548
|
}
|
|
1509
1549
|
if (data.type === "presenter-exit") {
|
|
1510
1550
|
if (expectedSessionId) {
|
|
1511
|
-
void
|
|
1551
|
+
void chunkV32F4I45_js.clearAudienceContent(expectedSessionId);
|
|
1512
1552
|
}
|
|
1513
|
-
if (
|
|
1553
|
+
if (chunkV32F4I45_js.endAudienceDisplay(window)) {
|
|
1514
1554
|
handlers.onPresenterEnded?.();
|
|
1515
1555
|
}
|
|
1516
1556
|
}
|
|
1517
1557
|
};
|
|
1518
1558
|
if (expectedSessionId) {
|
|
1519
1559
|
channel.postMessage({
|
|
1520
|
-
origin:
|
|
1560
|
+
origin: chunkV32F4I45_js.PRESENTATION_MESSAGE_ORIGIN,
|
|
1521
1561
|
type: "audience-ready",
|
|
1522
1562
|
sessionId: expectedSessionId
|
|
1523
1563
|
});
|
|
@@ -1531,7 +1571,7 @@ function useAudienceMode(input) {
|
|
|
1531
1571
|
}, []);
|
|
1532
1572
|
}
|
|
1533
1573
|
function usePresentationKeyboard(input) {
|
|
1534
|
-
const wheelBufferRef = react.useRef(
|
|
1574
|
+
const wheelBufferRef = react.useRef(chunkV32F4I45_js.createWheelStepBuffer());
|
|
1535
1575
|
const {
|
|
1536
1576
|
mode,
|
|
1537
1577
|
movePresentationSlide,
|
|
@@ -1552,14 +1592,14 @@ function usePresentationKeyboard(input) {
|
|
|
1552
1592
|
presentationSlideIndex,
|
|
1553
1593
|
setShowRehearsalSummary
|
|
1554
1594
|
} = input;
|
|
1555
|
-
const keyBufferRef = react.useRef(
|
|
1595
|
+
const keyBufferRef = react.useRef(chunkV32F4I45_js.createPresentationKeyBuffer());
|
|
1556
1596
|
react.useEffect(() => {
|
|
1557
|
-
if (mode !== "present" || !
|
|
1558
|
-
keyBufferRef.current =
|
|
1597
|
+
if (mode !== "present" || !chunkV32F4I45_js.acceptsPresentationInput()) {
|
|
1598
|
+
keyBufferRef.current = chunkV32F4I45_js.createPresentationKeyBuffer();
|
|
1559
1599
|
return;
|
|
1560
1600
|
}
|
|
1561
1601
|
const handleKeyDown = (event) => {
|
|
1562
|
-
const mapped =
|
|
1602
|
+
const mapped = chunkV32F4I45_js.mapPresentationKey(event, keyBufferRef.current);
|
|
1563
1603
|
if (mapped.action === "none") {
|
|
1564
1604
|
return;
|
|
1565
1605
|
}
|
|
@@ -1579,12 +1619,12 @@ function usePresentationKeyboard(input) {
|
|
|
1579
1619
|
movePresentationSlide(-1);
|
|
1580
1620
|
return;
|
|
1581
1621
|
case "first": {
|
|
1582
|
-
const first =
|
|
1622
|
+
const first = chunkV32F4I45_js.firstShowSlideIndex(showSlideIndexes);
|
|
1583
1623
|
navigateToSlide(first ?? 0);
|
|
1584
1624
|
return;
|
|
1585
1625
|
}
|
|
1586
1626
|
case "last": {
|
|
1587
|
-
const last =
|
|
1627
|
+
const last = chunkV32F4I45_js.lastShowSlideIndex(showSlideIndexes);
|
|
1588
1628
|
navigateToSlide(last ?? Math.max(0, slideCount - 1));
|
|
1589
1629
|
return;
|
|
1590
1630
|
}
|
|
@@ -1622,10 +1662,10 @@ function usePresentationKeyboard(input) {
|
|
|
1622
1662
|
}
|
|
1623
1663
|
};
|
|
1624
1664
|
const handleWheel = (event) => {
|
|
1625
|
-
if (mode !== "present" || !
|
|
1665
|
+
if (mode !== "present" || !chunkV32F4I45_js.acceptsPresentationInput()) {
|
|
1626
1666
|
return;
|
|
1627
1667
|
}
|
|
1628
|
-
const mapped =
|
|
1668
|
+
const mapped = chunkV32F4I45_js.mapPresentationWheel(event, wheelBufferRef.current);
|
|
1629
1669
|
if (mapped.intent === "next-slide") {
|
|
1630
1670
|
event.preventDefault();
|
|
1631
1671
|
movePresentationSlide(1);
|
|
@@ -1758,7 +1798,7 @@ function useRehearsalTimings(input) {
|
|
|
1758
1798
|
|
|
1759
1799
|
// src/viewer/hooks/presentation-mode/presentation-actions.ts
|
|
1760
1800
|
function handlePresentationActionImpl(action, deps) {
|
|
1761
|
-
|
|
1801
|
+
chunkV32F4I45_js.runPresentationAction(
|
|
1762
1802
|
action,
|
|
1763
1803
|
{ slideCount: deps.slidesLength, ...deps.elementId ? { elementId: deps.elementId } : {} },
|
|
1764
1804
|
{
|
|
@@ -1787,13 +1827,13 @@ function handlePresentationActionImpl(action, deps) {
|
|
|
1787
1827
|
function executeSlideTransition(nextSlideIndex, deps) {
|
|
1788
1828
|
const incomingSlide = deps.slides[nextSlideIndex];
|
|
1789
1829
|
const transition = deps.reverse ? deps.slides[deps.currentSlideIndex]?.transition : incomingSlide?.transition;
|
|
1790
|
-
const durationMs = deps.playTransition ?
|
|
1830
|
+
const durationMs = deps.playTransition ? chunkV32F4I45_js.resolveTransitionDurationMs(transition) : 0;
|
|
1791
1831
|
deps.clearPresentationTimers();
|
|
1792
1832
|
deps.setPresentationSlideIndex(nextSlideIndex);
|
|
1793
1833
|
deps.onSetActiveSlideIndex(nextSlideIndex);
|
|
1794
1834
|
deps.setPresentationSlideVisible(true);
|
|
1795
1835
|
deps.seedSlideAnimations(nextSlideIndex, { completed: deps.seedCompleted });
|
|
1796
|
-
const soundAction =
|
|
1836
|
+
const soundAction = chunkV32F4I45_js.resolveTransitionSoundAction(transition);
|
|
1797
1837
|
if (soundAction.kind === "play" && deps.onPlayActionSound) {
|
|
1798
1838
|
deps.onPlayActionSound(soundAction.soundPath, { loop: soundAction.loop });
|
|
1799
1839
|
} else if (soundAction.kind === "stop" && deps.onStopActionSound) {
|
|
@@ -1857,7 +1897,7 @@ function useSlideNavigation(input) {
|
|
|
1857
1897
|
});
|
|
1858
1898
|
const scheduleAutoAdvanceForSlide = react.useCallback(
|
|
1859
1899
|
(slideIndex) => {
|
|
1860
|
-
const delayMs =
|
|
1900
|
+
const delayMs = chunkV32F4I45_js.resolveAutoAdvanceDelayMs(slides[slideIndex], { useTimings });
|
|
1861
1901
|
if (delayMs === void 0) {
|
|
1862
1902
|
return;
|
|
1863
1903
|
}
|
|
@@ -1880,7 +1920,7 @@ function useSlideNavigation(input) {
|
|
|
1880
1920
|
if (availableSlideIndexes.length === 0) {
|
|
1881
1921
|
return;
|
|
1882
1922
|
}
|
|
1883
|
-
const pastLastSlide = direction === 1 && !
|
|
1923
|
+
const pastLastSlide = direction === 1 && !chunkV32F4I45_js.hasShowSlideAfter(presentationSlideIndex, availableSlideIndexes);
|
|
1884
1924
|
if (rehearsing && pastLastSlide) {
|
|
1885
1925
|
recordCurrentSlideTime(presentationSlideIndex);
|
|
1886
1926
|
try {
|
|
@@ -1898,9 +1938,9 @@ function useSlideNavigation(input) {
|
|
|
1898
1938
|
onAdvancePastLastSlide();
|
|
1899
1939
|
return;
|
|
1900
1940
|
}
|
|
1901
|
-
const nextSlideIndex = direction === 1 ?
|
|
1941
|
+
const nextSlideIndex = direction === 1 ? chunkV32F4I45_js.nextShowSlideIndex(presentationSlideIndex, availableSlideIndexes, {
|
|
1902
1942
|
loop: Boolean(loopContinuously) && !rehearsing
|
|
1903
|
-
}) :
|
|
1943
|
+
}) : chunkV32F4I45_js.previousShowSlideIndex(presentationSlideIndex, availableSlideIndexes);
|
|
1904
1944
|
if (nextSlideIndex === void 0 || nextSlideIndex === presentationSlideIndex) {
|
|
1905
1945
|
return;
|
|
1906
1946
|
}
|
|
@@ -2081,7 +2121,7 @@ function createCustomShowRunner(deps) {
|
|
|
2081
2121
|
return;
|
|
2082
2122
|
}
|
|
2083
2123
|
origin = returnAfter ? { showId: deps.getActiveCustomShowId(), slideIndex: deps.getPresentationSlideIndex() } : null;
|
|
2084
|
-
const first =
|
|
2124
|
+
const first = chunkV32F4I45_js.firstShowSlideIndex(chunkV32F4I45_js.resolveShowSlideIndexes(deps.getSlides(), target));
|
|
2085
2125
|
deps.setActiveCustomShowId(customShowId);
|
|
2086
2126
|
if (first !== void 0) {
|
|
2087
2127
|
deps.navigateToSlide(first);
|
|
@@ -2159,33 +2199,33 @@ function usePresentationActionExtensions(input) {
|
|
|
2159
2199
|
}
|
|
2160
2200
|
}, [navigateToSlideViaRef]);
|
|
2161
2201
|
const onOpenFile = react.useCallback((target) => {
|
|
2162
|
-
|
|
2202
|
+
chunkV32F4I45_js.safeOpenUrl(target);
|
|
2163
2203
|
}, []);
|
|
2164
2204
|
const onOpenPresentation = react.useCallback((target) => {
|
|
2165
|
-
|
|
2205
|
+
chunkV32F4I45_js.safeOpenUrl(target);
|
|
2166
2206
|
}, []);
|
|
2167
2207
|
const onRunProgram = react.useCallback(
|
|
2168
2208
|
(target) => {
|
|
2169
|
-
onAddRunProgramNotice?.(
|
|
2209
|
+
onAddRunProgramNotice?.(chunkV32F4I45_js.buildRunProgramNotice(target));
|
|
2170
2210
|
},
|
|
2171
2211
|
[onAddRunProgramNotice]
|
|
2172
2212
|
);
|
|
2173
2213
|
const onPlayMedia = react.useCallback(
|
|
2174
2214
|
(elementId) => {
|
|
2175
|
-
|
|
2215
|
+
chunkV32F4I45_js.toggleStageElementMedia(containerRef.current, elementId);
|
|
2176
2216
|
},
|
|
2177
2217
|
[containerRef]
|
|
2178
2218
|
);
|
|
2179
2219
|
const onOleVerb = react.useCallback(
|
|
2180
2220
|
(verb, elementId) => {
|
|
2181
|
-
const target =
|
|
2221
|
+
const target = chunkV32F4I45_js.resolveOleVerbTarget(slides[presentationSlideIndex], elementId, verb);
|
|
2182
2222
|
if (!target) {
|
|
2183
2223
|
return;
|
|
2184
2224
|
}
|
|
2185
2225
|
if (target.action === "download") {
|
|
2186
|
-
|
|
2226
|
+
chunkV32F4I45_js.downloadDataUrl(target.url, target.fileName ?? "download");
|
|
2187
2227
|
} else {
|
|
2188
|
-
|
|
2228
|
+
chunkV32F4I45_js.openUrlInNewTab(target.url);
|
|
2189
2229
|
}
|
|
2190
2230
|
},
|
|
2191
2231
|
[slides, presentationSlideIndex]
|
|
@@ -2216,22 +2256,22 @@ function usePresentationActionExtensions(input) {
|
|
|
2216
2256
|
};
|
|
2217
2257
|
}
|
|
2218
2258
|
function usePresenterConsole(slideIndex, active) {
|
|
2219
|
-
const timerRef = react.useRef(
|
|
2220
|
-
const [snapshot, setSnapshot] = react.useState(() =>
|
|
2259
|
+
const timerRef = react.useRef(chunkV32F4I45_js.createPresenterTimer());
|
|
2260
|
+
const [snapshot, setSnapshot] = react.useState(() => chunkV32F4I45_js.createInitialPresentationSnapshot(slideIndex));
|
|
2221
2261
|
const patch = react.useCallback((value) => {
|
|
2222
|
-
setSnapshot((current) =>
|
|
2262
|
+
setSnapshot((current) => chunkV32F4I45_js.mergePresentationSnapshot(current, value));
|
|
2223
2263
|
}, []);
|
|
2224
2264
|
react.useEffect(() => patch({ slideIndex }), [patch, slideIndex]);
|
|
2225
2265
|
react.useEffect(() => {
|
|
2226
2266
|
if (!active) {
|
|
2227
2267
|
return;
|
|
2228
2268
|
}
|
|
2229
|
-
timerRef.current =
|
|
2269
|
+
timerRef.current = chunkV32F4I45_js.resetPresenterTimer();
|
|
2230
2270
|
patch({ paused: false, elapsedMs: 0 });
|
|
2231
2271
|
const timer = window.setInterval(() => {
|
|
2232
2272
|
patch({
|
|
2233
2273
|
paused: timerRef.current.paused,
|
|
2234
|
-
elapsedMs:
|
|
2274
|
+
elapsedMs: chunkV32F4I45_js.presenterElapsed(timerRef.current)
|
|
2235
2275
|
});
|
|
2236
2276
|
}, 1e3);
|
|
2237
2277
|
return () => window.clearInterval(timer);
|
|
@@ -2241,19 +2281,19 @@ function usePresenterConsole(slideIndex, active) {
|
|
|
2241
2281
|
applyAudienceSnapshot: setSnapshot,
|
|
2242
2282
|
setBlackout: (blackout) => patch({ blackout }),
|
|
2243
2283
|
toggleTimer: () => {
|
|
2244
|
-
timerRef.current =
|
|
2284
|
+
timerRef.current = chunkV32F4I45_js.togglePresenterTimer(timerRef.current);
|
|
2245
2285
|
patch({
|
|
2246
2286
|
paused: timerRef.current.paused,
|
|
2247
|
-
elapsedMs:
|
|
2287
|
+
elapsedMs: chunkV32F4I45_js.presenterElapsed(timerRef.current)
|
|
2248
2288
|
});
|
|
2249
2289
|
},
|
|
2250
2290
|
resetTimer: () => {
|
|
2251
|
-
timerRef.current =
|
|
2291
|
+
timerRef.current = chunkV32F4I45_js.resetPresenterTimer();
|
|
2252
2292
|
patch({ paused: false, elapsedMs: 0 });
|
|
2253
2293
|
},
|
|
2254
2294
|
stepZoom: (direction) => setSnapshot(
|
|
2255
|
-
(current) =>
|
|
2256
|
-
zoom:
|
|
2295
|
+
(current) => chunkV32F4I45_js.mergePresentationSnapshot(current, {
|
|
2296
|
+
zoom: chunkV32F4I45_js.stepPresenterZoom(
|
|
2257
2297
|
current.zoom ?? { scale: 1, originX: 0.5, originY: 0.5 },
|
|
2258
2298
|
direction
|
|
2259
2299
|
)
|
|
@@ -2308,7 +2348,7 @@ function usePresentationMode(input) {
|
|
|
2308
2348
|
const [allSlidesOpen, setAllSlidesOpen] = react.useState(false);
|
|
2309
2349
|
const [endOfShowVisible, setEndOfShowVisible] = react.useState(false);
|
|
2310
2350
|
const [presentationStartTime, setPresentationStartTime] = react.useState(null);
|
|
2311
|
-
const showGuard = react.useMemo(() =>
|
|
2351
|
+
const showGuard = react.useMemo(() => chunkV32F4I45_js.createPresenterShowGuard(), []);
|
|
2312
2352
|
const {
|
|
2313
2353
|
presentationAnimations,
|
|
2314
2354
|
presentationElementStates,
|
|
@@ -2408,7 +2448,7 @@ function usePresentationMode(input) {
|
|
|
2408
2448
|
actionExtensions.bindNavigateToSlide(navigateToSlide);
|
|
2409
2449
|
const movePresentationSlide = react.useCallback(
|
|
2410
2450
|
(direction, trigger = "explicit") => {
|
|
2411
|
-
if (!
|
|
2451
|
+
if (!chunkV32F4I45_js.acceptsPresentationInput()) {
|
|
2412
2452
|
return;
|
|
2413
2453
|
}
|
|
2414
2454
|
if (endOfShowVisible) {
|
|
@@ -2477,7 +2517,7 @@ function usePresentationMode(input) {
|
|
|
2477
2517
|
onSetMode("present");
|
|
2478
2518
|
}, [containerRef, onSetMode, setRehearsing]);
|
|
2479
2519
|
const enterPresentModeFromBeginning = react.useCallback(() => {
|
|
2480
|
-
const first =
|
|
2520
|
+
const first = chunkV32F4I45_js.firstShowSlideIndex(visibleSlideIndexes);
|
|
2481
2521
|
if (first !== void 0) {
|
|
2482
2522
|
onSetActiveSlideIndex(first);
|
|
2483
2523
|
}
|
|
@@ -2557,7 +2597,7 @@ function usePresentationMode(input) {
|
|
|
2557
2597
|
if (mode !== "present") {
|
|
2558
2598
|
return;
|
|
2559
2599
|
}
|
|
2560
|
-
return
|
|
2600
|
+
return chunkV32F4I45_js.attachPresentationVisibilityPause({
|
|
2561
2601
|
root: containerRef.current ?? void 0,
|
|
2562
2602
|
onHidden: () => clearPresentationTimersRef.current(),
|
|
2563
2603
|
onVisible: () => scheduleAutoAdvanceRef.current(presentationSlideIndexRef.current)
|
|
@@ -2565,7 +2605,7 @@ function usePresentationMode(input) {
|
|
|
2565
2605
|
}, [mode, containerRef]);
|
|
2566
2606
|
react.useLayoutEffect(() => {
|
|
2567
2607
|
if (mode === "present") {
|
|
2568
|
-
const idx =
|
|
2608
|
+
const idx = chunkV32F4I45_js.presentationEntrySlideIndex(
|
|
2569
2609
|
activeSlideIndexRef.current,
|
|
2570
2610
|
visibleSlideIndexesRef.current
|
|
2571
2611
|
);
|
|
@@ -2644,11 +2684,11 @@ function usePresentationMode(input) {
|
|
|
2644
2684
|
return void 0;
|
|
2645
2685
|
}
|
|
2646
2686
|
const incoming = slides[transitionOverlay.incomingSlideIndex];
|
|
2647
|
-
return
|
|
2687
|
+
return chunkV32F4I45_js.buildMorphTransitionPlan(
|
|
2648
2688
|
slides[transitionOverlay.outgoingSlideIndex],
|
|
2649
2689
|
incoming,
|
|
2650
2690
|
transitionOverlay.durationMs,
|
|
2651
|
-
|
|
2691
|
+
chunkV32F4I45_js.morphOptionToMode(transitionOverlay.transition.morphOption),
|
|
2652
2692
|
// `PresentationStage` stacks the incoming slide's elements above its
|
|
2653
2693
|
// template shapes (`zIndex = templateElements.length + index`), so a
|
|
2654
2694
|
// z-index journey has to start counting where the stage does.
|
|
@@ -2673,7 +2713,7 @@ function usePresentationMode(input) {
|
|
|
2673
2713
|
if (!morphPlan) {
|
|
2674
2714
|
return presentationKeyframesCss;
|
|
2675
2715
|
}
|
|
2676
|
-
const imageRules =
|
|
2716
|
+
const imageRules = chunkV32F4I45_js.buildMorphAnimationRules(morphPlan, "", "incoming", "image");
|
|
2677
2717
|
return `${presentationKeyframesCss ?? ""}
|
|
2678
2718
|
${morphPlan.keyframesCss}
|
|
2679
2719
|
${imageRules}`;
|
|
@@ -2969,8 +3009,17 @@ function useFindReplace({
|
|
|
2969
3009
|
const [findMatchCase, setFindMatchCase] = react.useState(false);
|
|
2970
3010
|
const [findResults, setFindResults] = react.useState([]);
|
|
2971
3011
|
const [findResultIndex, setFindResultIndex] = react.useState(-1);
|
|
3012
|
+
const pendingRefindRef = react.useRef(false);
|
|
3013
|
+
react.useEffect(() => {
|
|
3014
|
+
if (findReplaceOpen) {
|
|
3015
|
+
return;
|
|
3016
|
+
}
|
|
3017
|
+
setFindResults([]);
|
|
3018
|
+
setFindResultIndex(-1);
|
|
3019
|
+
pendingRefindRef.current = false;
|
|
3020
|
+
}, [findReplaceOpen]);
|
|
2972
3021
|
const performFind = react.useCallback(() => {
|
|
2973
|
-
const results =
|
|
3022
|
+
const results = chunkV32F4I45_js.findInSlides(slides, findQuery, { matchCase: findMatchCase });
|
|
2974
3023
|
if (!findQuery) {
|
|
2975
3024
|
setFindResults([]);
|
|
2976
3025
|
setFindResultIndex(-1);
|
|
@@ -3004,7 +3053,7 @@ function useFindReplace({
|
|
|
3004
3053
|
return;
|
|
3005
3054
|
}
|
|
3006
3055
|
onUpdateSlides(
|
|
3007
|
-
(prevSlides) =>
|
|
3056
|
+
(prevSlides) => chunkV32F4I45_js.applyFindReplacements(prevSlides, toReplace, replaceQuery).slides
|
|
3008
3057
|
);
|
|
3009
3058
|
onMarkDirty();
|
|
3010
3059
|
},
|
|
@@ -3015,20 +3064,27 @@ function useFindReplace({
|
|
|
3015
3064
|
return;
|
|
3016
3065
|
}
|
|
3017
3066
|
applyReplacements([findResults[findResultIndex]]);
|
|
3018
|
-
|
|
3019
|
-
}, [findResults, findResultIndex, applyReplacements
|
|
3067
|
+
pendingRefindRef.current = true;
|
|
3068
|
+
}, [findResults, findResultIndex, applyReplacements]);
|
|
3020
3069
|
const handleReplaceAll = react.useCallback(() => {
|
|
3021
3070
|
if (findResults.length === 0) {
|
|
3022
3071
|
return;
|
|
3023
3072
|
}
|
|
3024
3073
|
applyReplacements(findResults);
|
|
3025
|
-
|
|
3026
|
-
}, [findResults, applyReplacements
|
|
3074
|
+
pendingRefindRef.current = true;
|
|
3075
|
+
}, [findResults, applyReplacements]);
|
|
3076
|
+
react.useEffect(() => {
|
|
3077
|
+
if (!pendingRefindRef.current) {
|
|
3078
|
+
return;
|
|
3079
|
+
}
|
|
3080
|
+
pendingRefindRef.current = false;
|
|
3081
|
+
performFind();
|
|
3082
|
+
}, [performFind]);
|
|
3027
3083
|
react.useEffect(() => {
|
|
3028
3084
|
const handler = (event) => {
|
|
3029
|
-
const { action } =
|
|
3085
|
+
const { action } = chunkV32F4I45_js.mapEditorKey(event, {
|
|
3030
3086
|
canEdit: mode === "edit",
|
|
3031
|
-
isTextInputTarget:
|
|
3087
|
+
isTextInputTarget: chunkV32F4I45_js.isEditorTextInputTarget(event.target)
|
|
3032
3088
|
});
|
|
3033
3089
|
if (action !== "find") {
|
|
3034
3090
|
return;
|
|
@@ -3139,7 +3195,7 @@ function addCommentToSlide(slides, slideIndex, text, authorName, elementId, ment
|
|
|
3139
3195
|
if (!slide) {
|
|
3140
3196
|
return { slides, didAdd: false };
|
|
3141
3197
|
}
|
|
3142
|
-
const next =
|
|
3198
|
+
const next = chunkV32F4I45_js.addCommentToList(
|
|
3143
3199
|
slide.comments || [],
|
|
3144
3200
|
text,
|
|
3145
3201
|
authorName,
|
|
@@ -3160,7 +3216,7 @@ function removeCommentFromSlide(slides, slideIndex, commentId) {
|
|
|
3160
3216
|
if (!slide) {
|
|
3161
3217
|
return { slides, didDelete: false };
|
|
3162
3218
|
}
|
|
3163
|
-
const next =
|
|
3219
|
+
const next = chunkV32F4I45_js.removeCommentFromList(slide.comments || [], commentId);
|
|
3164
3220
|
if (!next) {
|
|
3165
3221
|
return { slides, didDelete: false };
|
|
3166
3222
|
}
|
|
@@ -3171,7 +3227,7 @@ function editCommentInSlide(slides, slideIndex, commentId, newText) {
|
|
|
3171
3227
|
if (!slide) {
|
|
3172
3228
|
return { slides, didUpdate: false };
|
|
3173
3229
|
}
|
|
3174
|
-
const next =
|
|
3230
|
+
const next = chunkV32F4I45_js.editCommentInList(slide.comments || [], commentId, newText);
|
|
3175
3231
|
if (!next) {
|
|
3176
3232
|
return { slides, didUpdate: false };
|
|
3177
3233
|
}
|
|
@@ -3182,7 +3238,7 @@ function toggleResolvedInSlide(slides, slideIndex, commentId) {
|
|
|
3182
3238
|
if (!slide) {
|
|
3183
3239
|
return { slides, didUpdate: false };
|
|
3184
3240
|
}
|
|
3185
|
-
const next =
|
|
3241
|
+
const next = chunkV32F4I45_js.toggleCommentResolvedInList(slide.comments || [], commentId);
|
|
3186
3242
|
if (!next) {
|
|
3187
3243
|
return { slides, didUpdate: false };
|
|
3188
3244
|
}
|
|
@@ -3193,7 +3249,7 @@ function addReplyToSlide(slides, slideIndex, parentId, text, authorName, mention
|
|
|
3193
3249
|
if (!slide) {
|
|
3194
3250
|
return { slides, didAdd: false };
|
|
3195
3251
|
}
|
|
3196
|
-
const next =
|
|
3252
|
+
const next = chunkV32F4I45_js.replyToCommentInList(slide.comments || [], parentId, text, authorName);
|
|
3197
3253
|
if (!next) {
|
|
3198
3254
|
return { slides, didAdd: false };
|
|
3199
3255
|
}
|
|
@@ -3580,7 +3636,7 @@ function useDerivedElementState(input) {
|
|
|
3580
3636
|
return [];
|
|
3581
3637
|
}
|
|
3582
3638
|
return [
|
|
3583
|
-
...
|
|
3639
|
+
...chunkV32F4I45_js.visibleTemplateElements(activeSlide, templateElementsBySlideId[activeSlide.id] ?? [])
|
|
3584
3640
|
];
|
|
3585
3641
|
}, [activeSlide, templateElementsBySlideId]);
|
|
3586
3642
|
const activeMaster = slideMasters[activeMasterIndex];
|
|
@@ -3647,7 +3703,7 @@ function useViewerCoreState(_input) {
|
|
|
3647
3703
|
const marqueeStateRef = react.useRef(null);
|
|
3648
3704
|
const isDrawingRef = react.useRef(false);
|
|
3649
3705
|
const justInteractedRef = react.useRef(false);
|
|
3650
|
-
const livePatcher = react.useMemo(() =>
|
|
3706
|
+
const livePatcher = react.useMemo(() => chunkV32F4I45_js.createCollaborationLivePatcher(), []);
|
|
3651
3707
|
react.useEffect(() => () => livePatcher.dispose(), [livePatcher]);
|
|
3652
3708
|
const slidesRef = react.useRef([]);
|
|
3653
3709
|
const [mode, setMode] = react.useState("edit");
|
|
@@ -3656,8 +3712,8 @@ function useViewerCoreState(_input) {
|
|
|
3656
3712
|
const [slides, setSlides] = react.useState([]);
|
|
3657
3713
|
const [templateElementsBySlideId, setTemplateElementsBySlideId] = react.useState({});
|
|
3658
3714
|
const [canvasSize, setCanvasSize] = react.useState({
|
|
3659
|
-
width:
|
|
3660
|
-
height:
|
|
3715
|
+
width: chunkLJ46KXUV_js.DEFAULT_CANVAS_WIDTH,
|
|
3716
|
+
height: chunkLJ46KXUV_js.DEFAULT_CANVAS_HEIGHT
|
|
3661
3717
|
});
|
|
3662
3718
|
const [slideSizeEmu, setSlideSizeEmu] = react.useState();
|
|
3663
3719
|
const [activeSlideIndex, setActiveSlideIndex] = react.useState(0);
|
|
@@ -3678,7 +3734,7 @@ function useViewerCoreState(_input) {
|
|
|
3678
3734
|
const resolved = typeof value === "function" ? value(inlineEditingTextRef.current) : value;
|
|
3679
3735
|
inlineEditingTextRef.current = resolved;
|
|
3680
3736
|
setInlineEditingTextBase(value);
|
|
3681
|
-
|
|
3737
|
+
chunkV32F4I45_js.publishLiveInlineText(
|
|
3682
3738
|
livePatcher,
|
|
3683
3739
|
slidesRef.current[activeSlideIndexRef.current],
|
|
3684
3740
|
inlineEditingElementIdRef.current,
|
|
@@ -3973,8 +4029,8 @@ function useViewerState(input) {
|
|
|
3973
4029
|
}
|
|
3974
4030
|
|
|
3975
4031
|
// src/viewer/utils/glyph-outline-cache.ts
|
|
3976
|
-
var glyphOutlineFontCache = new
|
|
3977
|
-
var getGlyphOutline =
|
|
4032
|
+
var glyphOutlineFontCache = new chunkV32F4I45_js.GlyphOutlineFontCache();
|
|
4033
|
+
var getGlyphOutline = chunkV32F4I45_js.createGlyphOutlineLookup(glyphOutlineFontCache);
|
|
3978
4034
|
|
|
3979
4035
|
// src/viewer/hooks/useLoadContent.ts
|
|
3980
4036
|
function useLoadContent({
|
|
@@ -4033,8 +4089,8 @@ function useLoadContent({
|
|
|
4033
4089
|
}
|
|
4034
4090
|
let cancelled = false;
|
|
4035
4091
|
const token = ++renderTokenRef.current;
|
|
4036
|
-
const handler = new
|
|
4037
|
-
const resources =
|
|
4092
|
+
const handler = new chunkV32F4I45_js.PptxHandler();
|
|
4093
|
+
const resources = chunkV32F4I45_js.createPresentationLoadResources(handler);
|
|
4038
4094
|
const loadBlobUrls = resources.blobUrls;
|
|
4039
4095
|
(async () => {
|
|
4040
4096
|
try {
|
|
@@ -4055,12 +4111,12 @@ function useLoadContent({
|
|
|
4055
4111
|
}
|
|
4056
4112
|
const mediaElements = [];
|
|
4057
4113
|
for (const slide of parsed.slides) {
|
|
4058
|
-
|
|
4114
|
+
chunkV32F4I45_js.collectMediaElements(slide.elements, mediaElements);
|
|
4059
4115
|
}
|
|
4060
4116
|
const nextMediaUrls = /* @__PURE__ */ new Map();
|
|
4061
4117
|
await Promise.all(
|
|
4062
4118
|
mediaElements.map(async (mediaElement) => {
|
|
4063
|
-
const resolved = await
|
|
4119
|
+
const resolved = await chunkV32F4I45_js.resolveMediaElementSource(mediaElement, handler);
|
|
4064
4120
|
if (resolved.missing || !resolved.mediaPath || !resolved.url) {
|
|
4065
4121
|
mediaElement.mediaMissing = true;
|
|
4066
4122
|
return;
|
|
@@ -4071,7 +4127,7 @@ function useLoadContent({
|
|
|
4071
4127
|
}
|
|
4072
4128
|
})
|
|
4073
4129
|
);
|
|
4074
|
-
const { paths: imagePaths, refs: imageRefs } =
|
|
4130
|
+
const { paths: imagePaths, refs: imageRefs } = chunkV32F4I45_js.collectImagePaths(parsed.slides);
|
|
4075
4131
|
let nextSlides = parsed.slides;
|
|
4076
4132
|
if (imagePaths.size > 0) {
|
|
4077
4133
|
const resolvedMap = /* @__PURE__ */ new Map();
|
|
@@ -4087,15 +4143,15 @@ function useLoadContent({
|
|
|
4087
4143
|
})
|
|
4088
4144
|
);
|
|
4089
4145
|
nextSlides = parsed.slides.map((s) => {
|
|
4090
|
-
const newElements =
|
|
4146
|
+
const newElements = chunkV32F4I45_js.applyImagePathPatches(s.elements, resolvedMap, imageRefs);
|
|
4091
4147
|
return newElements === s.elements ? s : { ...s, elements: newElements };
|
|
4092
4148
|
});
|
|
4093
4149
|
}
|
|
4094
|
-
nextSlides = await
|
|
4150
|
+
nextSlides = await chunkV32F4I45_js.resolveTableCellImageUrls(
|
|
4095
4151
|
nextSlides,
|
|
4096
4152
|
(path) => handler.getImageData(path)
|
|
4097
4153
|
);
|
|
4098
|
-
const nextTableStyleMap = await
|
|
4154
|
+
const nextTableStyleMap = await chunkV32F4I45_js.resolveTableStyleImageUrls(
|
|
4099
4155
|
parsed.tableStyleMap,
|
|
4100
4156
|
(path) => handler.getImageData(path)
|
|
4101
4157
|
);
|
|
@@ -4114,12 +4170,12 @@ function useLoadContent({
|
|
|
4114
4170
|
}
|
|
4115
4171
|
resources.commit();
|
|
4116
4172
|
handlerRef.current = handler;
|
|
4117
|
-
const partition =
|
|
4173
|
+
const partition = chunkV32F4I45_js.partitionTemplateElements(nextSlides);
|
|
4118
4174
|
setSlides(partition.slides);
|
|
4119
4175
|
setTemplateElementsBySlideId(partition.templateElementsBySlideId);
|
|
4120
4176
|
setCanvasSize({
|
|
4121
|
-
width: parsed.width ??
|
|
4122
|
-
height: parsed.height ??
|
|
4177
|
+
width: parsed.width ?? chunkLJ46KXUV_js.DEFAULT_CANVAS_WIDTH,
|
|
4178
|
+
height: parsed.height ?? chunkLJ46KXUV_js.DEFAULT_CANVAS_HEIGHT
|
|
4123
4179
|
});
|
|
4124
4180
|
setSlideSizeEmu(
|
|
4125
4181
|
typeof parsed.widthEmu === "number" && typeof parsed.heightEmu === "number" && parsed.widthEmu > 0 && parsed.heightEmu > 0 ? {
|
|
@@ -4132,7 +4188,7 @@ function useLoadContent({
|
|
|
4132
4188
|
setLayoutOptions(parsed.layoutOptions ?? []);
|
|
4133
4189
|
setSlideMasters(parsed.slideMasters ?? []);
|
|
4134
4190
|
setModernCommentAuthors(parsed.modernCommentAuthors ?? []);
|
|
4135
|
-
setRecentColors(
|
|
4191
|
+
setRecentColors(chunkV32F4I45_js.seedRecentColors({ mruColors: parsed.mruColors }));
|
|
4136
4192
|
setTheme(parsed.theme);
|
|
4137
4193
|
setTableStyleMap(nextTableStyleMap);
|
|
4138
4194
|
setTableStylesDefaultId(parsed.tableStylesDefaultId);
|
|
@@ -4140,7 +4196,7 @@ function useLoadContent({
|
|
|
4140
4196
|
setThemeOptions(parsed.themeOptions ?? []);
|
|
4141
4197
|
setCustomShows(parsed.customShows ?? []);
|
|
4142
4198
|
setActiveCustomShowId(
|
|
4143
|
-
|
|
4199
|
+
chunkV32F4I45_js.resolveAuthoredCustomShowId(parsed.presentationProperties, parsed.customShows) ?? null
|
|
4144
4200
|
);
|
|
4145
4201
|
setSections(parsed.sections ?? []);
|
|
4146
4202
|
setPresentationProperties(parsed.presentationProperties ?? {});
|
|
@@ -4164,11 +4220,11 @@ function useLoadContent({
|
|
|
4164
4220
|
setHasMacros(parsed.hasMacros === true);
|
|
4165
4221
|
setHasDigitalSignatures(parsed.hasDigitalSignatures === true);
|
|
4166
4222
|
setDigitalSignatureCount(parsed.digitalSignatureCount ?? 0);
|
|
4167
|
-
setGuides(
|
|
4168
|
-
setReadOnlyRecommendation(
|
|
4223
|
+
setGuides(chunkV32F4I45_js.buildInitialGuides(parsed.presentationGuides, parsed.slides[0]?.guides));
|
|
4224
|
+
setReadOnlyRecommendation(chunkV32F4I45_js.readOnlyRecommendation(parsed));
|
|
4169
4225
|
setModifyVerifier(parsed.modifyVerifier ?? void 0);
|
|
4170
4226
|
setCompatToasts(
|
|
4171
|
-
|
|
4227
|
+
chunkV32F4I45_js.compatibilityWarningToasts([
|
|
4172
4228
|
...parsed.warnings ?? [],
|
|
4173
4229
|
...parsed.slides.flatMap((slide) => slide.warnings ?? [])
|
|
4174
4230
|
])
|
|
@@ -4180,7 +4236,7 @@ function useLoadContent({
|
|
|
4180
4236
|
onContentApplied?.();
|
|
4181
4237
|
} catch (err) {
|
|
4182
4238
|
if (!cancelled && token === renderTokenRef.current) {
|
|
4183
|
-
if (err instanceof
|
|
4239
|
+
if (err instanceof chunkV32F4I45_js.EncryptedFileError) {
|
|
4184
4240
|
setIsEncrypted(true);
|
|
4185
4241
|
} else {
|
|
4186
4242
|
console.error("[pptx] Failed to load presentation content:", err);
|
|
@@ -4209,7 +4265,7 @@ function useLoadContent({
|
|
|
4209
4265
|
}
|
|
4210
4266
|
function useAutosave(input) {
|
|
4211
4267
|
const { isDirty, filePath, serializeSlides, enabled = true, getChangeSources } = input;
|
|
4212
|
-
const intervalMs =
|
|
4268
|
+
const intervalMs = chunkV32F4I45_js.resolveAutosaveIntervalMs({
|
|
4213
4269
|
hostIntervalMs: input.intervalMs,
|
|
4214
4270
|
optionsIntervalSeconds: input.intervalSeconds
|
|
4215
4271
|
});
|
|
@@ -4240,7 +4296,7 @@ function useAutosave(input) {
|
|
|
4240
4296
|
return;
|
|
4241
4297
|
}
|
|
4242
4298
|
const sources = changeSourcesRef.current?.() ?? [];
|
|
4243
|
-
if (!
|
|
4299
|
+
if (!chunkV32F4I45_js.shouldWriteAutosaveSnapshot({
|
|
4244
4300
|
filePath: path,
|
|
4245
4301
|
isDirty: isDirtyRef.current,
|
|
4246
4302
|
saving: isSavingRef.current,
|
|
@@ -4258,8 +4314,8 @@ function useAutosave(input) {
|
|
|
4258
4314
|
isSavingRef.current = false;
|
|
4259
4315
|
return;
|
|
4260
4316
|
}
|
|
4261
|
-
await
|
|
4262
|
-
lastSnapshotRef.current =
|
|
4317
|
+
await chunkV32F4I45_js.saveAutosaveSnapshot(path, data);
|
|
4318
|
+
lastSnapshotRef.current = chunkV32F4I45_js.autosaveSnapshotMark(path, sources);
|
|
4263
4319
|
setAutosaveStatus({ state: "saved", timestamp: Date.now() });
|
|
4264
4320
|
} catch (err) {
|
|
4265
4321
|
setAutosaveStatus({
|
|
@@ -4313,13 +4369,13 @@ function useElementOperations(input) {
|
|
|
4313
4369
|
inlineEditingText
|
|
4314
4370
|
} = input;
|
|
4315
4371
|
const liveTextSegments = react.useCallback(() => {
|
|
4316
|
-
if (!selectedElement || !
|
|
4372
|
+
if (!selectedElement || !chunkV32F4I45_js.hasTextProperties(selectedElement)) {
|
|
4317
4373
|
return void 0;
|
|
4318
4374
|
}
|
|
4319
4375
|
if (selectedElement.id !== inlineEditingElementId) {
|
|
4320
4376
|
return selectedElement.textSegments;
|
|
4321
4377
|
}
|
|
4322
|
-
return
|
|
4378
|
+
return chunkV32F4I45_js.remapTextToSegments(
|
|
4323
4379
|
inlineEditingText,
|
|
4324
4380
|
selectedElement.textSegments,
|
|
4325
4381
|
selectedElement.textStyle
|
|
@@ -4360,11 +4416,11 @@ function useElementOperations(input) {
|
|
|
4360
4416
|
(elementId, updates) => {
|
|
4361
4417
|
if (masterView?.target) {
|
|
4362
4418
|
applyMasterViewWrite(
|
|
4363
|
-
|
|
4419
|
+
chunkV32F4I45_js.updateMasterViewElement(masterView, masterView.target, elementId, updates)
|
|
4364
4420
|
);
|
|
4365
4421
|
return;
|
|
4366
4422
|
}
|
|
4367
|
-
if (
|
|
4423
|
+
if (chunkV32F4I45_js.isTemplateElementId(elementId)) {
|
|
4368
4424
|
const slideId = activeSlide?.id;
|
|
4369
4425
|
if (slideId) {
|
|
4370
4426
|
setTemplateElementsBySlideId((prev) => ({
|
|
@@ -4375,7 +4431,7 @@ function useElementOperations(input) {
|
|
|
4375
4431
|
}));
|
|
4376
4432
|
}
|
|
4377
4433
|
} else {
|
|
4378
|
-
setSlides((prev) =>
|
|
4434
|
+
setSlides((prev) => chunkV32F4I45_js.updateElement(prev, activeSlideIndex, elementId, updates));
|
|
4379
4435
|
}
|
|
4380
4436
|
history.markDirty();
|
|
4381
4437
|
},
|
|
@@ -4400,7 +4456,7 @@ function useElementOperations(input) {
|
|
|
4400
4456
|
);
|
|
4401
4457
|
const updateSelectedShapeStyle = react.useCallback(
|
|
4402
4458
|
(updates) => {
|
|
4403
|
-
if (!selectedElement || !
|
|
4459
|
+
if (!selectedElement || !chunkV32F4I45_js.hasShapeProperties(selectedElement)) {
|
|
4404
4460
|
return;
|
|
4405
4461
|
}
|
|
4406
4462
|
updateSelectedElement({
|
|
@@ -4411,43 +4467,51 @@ function useElementOperations(input) {
|
|
|
4411
4467
|
);
|
|
4412
4468
|
const updateSelectedTextStyle = react.useCallback(
|
|
4413
4469
|
(updates) => {
|
|
4414
|
-
if (!selectedElement || !
|
|
4470
|
+
if (!selectedElement || !chunkV32F4I45_js.hasTextProperties(selectedElement)) {
|
|
4415
4471
|
return;
|
|
4416
4472
|
}
|
|
4417
4473
|
const isLiveEditing = selectedElement.id === inlineEditingElementId;
|
|
4418
4474
|
const currentSegments = liveTextSegments();
|
|
4419
|
-
const
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
updateSelectedElement({
|
|
4428
|
-
...result.patch,
|
|
4429
|
-
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
4430
|
-
});
|
|
4431
|
-
return;
|
|
4475
|
+
const { patch, newSelection } = chunkV32F4I45_js.applyTextStyleUpdate(
|
|
4476
|
+
selectedElement,
|
|
4477
|
+
updates,
|
|
4478
|
+
chunkV32F4I45_js.getInlineEditorSelection(currentSegments),
|
|
4479
|
+
currentSegments
|
|
4480
|
+
);
|
|
4481
|
+
if (newSelection) {
|
|
4482
|
+
chunkV32F4I45_js.setPendingSelectionRestore(newSelection);
|
|
4432
4483
|
}
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4484
|
+
updateSelectedElement({
|
|
4485
|
+
...patch,
|
|
4486
|
+
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
4487
|
+
});
|
|
4488
|
+
},
|
|
4489
|
+
[
|
|
4490
|
+
selectedElement,
|
|
4491
|
+
updateSelectedElement,
|
|
4492
|
+
inlineEditingElementId,
|
|
4493
|
+
inlineEditingText,
|
|
4494
|
+
liveTextSegments
|
|
4495
|
+
]
|
|
4496
|
+
);
|
|
4497
|
+
const toggleSelectedBullets = react.useCallback(
|
|
4498
|
+
(kind) => {
|
|
4499
|
+
if (!selectedElement || !chunkV32F4I45_js.hasTextProperties(selectedElement)) {
|
|
4444
4500
|
return;
|
|
4445
4501
|
}
|
|
4446
|
-
const
|
|
4447
|
-
const
|
|
4502
|
+
const isLiveEditing = selectedElement.id === inlineEditingElementId;
|
|
4503
|
+
const currentSegments = liveTextSegments();
|
|
4504
|
+
const { patch, newSelection } = chunkV32F4I45_js.toggleSelectionBullets(
|
|
4505
|
+
selectedElement,
|
|
4506
|
+
kind,
|
|
4507
|
+
chunkV32F4I45_js.getInlineEditorSelection(currentSegments),
|
|
4508
|
+
currentSegments
|
|
4509
|
+
);
|
|
4510
|
+
if (newSelection) {
|
|
4511
|
+
chunkV32F4I45_js.setPendingSelectionRestore(newSelection);
|
|
4512
|
+
}
|
|
4448
4513
|
updateSelectedElement({
|
|
4449
|
-
|
|
4450
|
-
textSegments: newSegments,
|
|
4514
|
+
...patch,
|
|
4451
4515
|
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
4452
4516
|
});
|
|
4453
4517
|
},
|
|
@@ -4461,14 +4525,14 @@ function useElementOperations(input) {
|
|
|
4461
4525
|
);
|
|
4462
4526
|
const updateSelectedTextCase = react.useCallback(
|
|
4463
4527
|
(mode) => {
|
|
4464
|
-
if (!selectedElement || !
|
|
4528
|
+
if (!selectedElement || !chunkV32F4I45_js.hasTextProperties(selectedElement)) {
|
|
4465
4529
|
return;
|
|
4466
4530
|
}
|
|
4467
4531
|
const isLiveEditing = selectedElement.id === inlineEditingElementId;
|
|
4468
4532
|
const currentSegments = liveTextSegments();
|
|
4469
|
-
const inlineSel =
|
|
4533
|
+
const inlineSel = chunkV32F4I45_js.getInlineEditorSelection(currentSegments);
|
|
4470
4534
|
if (inlineSel && currentSegments) {
|
|
4471
|
-
const newSegments =
|
|
4535
|
+
const newSegments = chunkV32F4I45_js.applyCaseTransformToSegments(currentSegments, inlineSel, mode);
|
|
4472
4536
|
updateSelectedElement({
|
|
4473
4537
|
textSegments: newSegments,
|
|
4474
4538
|
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
@@ -4477,7 +4541,7 @@ function useElementOperations(input) {
|
|
|
4477
4541
|
}
|
|
4478
4542
|
const updates = {};
|
|
4479
4543
|
if (currentSegments && currentSegments.length > 0) {
|
|
4480
|
-
updates.textSegments =
|
|
4544
|
+
updates.textSegments = chunkV32F4I45_js.applyCaseTransformToSegments(
|
|
4481
4545
|
currentSegments,
|
|
4482
4546
|
null,
|
|
4483
4547
|
mode
|
|
@@ -4485,7 +4549,7 @@ function useElementOperations(input) {
|
|
|
4485
4549
|
}
|
|
4486
4550
|
const baseText = isLiveEditing ? inlineEditingText : selectedElement.text;
|
|
4487
4551
|
if (typeof baseText === "string") {
|
|
4488
|
-
updates.text =
|
|
4552
|
+
updates.text = chunkV32F4I45_js.transformTextCase(baseText, mode);
|
|
4489
4553
|
}
|
|
4490
4554
|
updateSelectedElement(updates);
|
|
4491
4555
|
},
|
|
@@ -4504,15 +4568,15 @@ function useElementOperations(input) {
|
|
|
4504
4568
|
[setSlides]
|
|
4505
4569
|
);
|
|
4506
4570
|
const masterViewTarget = masterView?.target ?? null;
|
|
4507
|
-
const activeElements = masterViewTarget ?
|
|
4571
|
+
const activeElements = masterViewTarget ? chunkV32F4I45_js.masterViewElements(masterView, masterViewTarget) : editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4508
4572
|
const updateActiveElements = react.useCallback(
|
|
4509
4573
|
(updater) => {
|
|
4510
4574
|
if (masterView?.target) {
|
|
4511
4575
|
applyMasterViewWrite(
|
|
4512
|
-
|
|
4576
|
+
chunkV32F4I45_js.replaceMasterViewElements(
|
|
4513
4577
|
masterView,
|
|
4514
4578
|
masterView.target,
|
|
4515
|
-
updater(
|
|
4579
|
+
updater(chunkV32F4I45_js.masterViewElements(masterView, masterView.target))
|
|
4516
4580
|
)
|
|
4517
4581
|
);
|
|
4518
4582
|
return;
|
|
@@ -4554,6 +4618,7 @@ function useElementOperations(input) {
|
|
|
4554
4618
|
updateSelectedElement,
|
|
4555
4619
|
updateSelectedShapeStyle,
|
|
4556
4620
|
updateSelectedTextStyle,
|
|
4621
|
+
toggleSelectedBullets,
|
|
4557
4622
|
updateSelectedTextCase,
|
|
4558
4623
|
updateSlides,
|
|
4559
4624
|
activeElements,
|
|
@@ -4565,7 +4630,7 @@ function useSectionOperations(input) {
|
|
|
4565
4630
|
const { sections, setSections, slides, setSlides, markDirty } = input;
|
|
4566
4631
|
const addSection2 = react.useCallback(
|
|
4567
4632
|
(name, afterSlideIndex) => {
|
|
4568
|
-
const result =
|
|
4633
|
+
const result = chunkV32F4I45_js.addSection(sections, slides, name, afterSlideIndex);
|
|
4569
4634
|
setSlides(result.slides);
|
|
4570
4635
|
setSections(result.sections);
|
|
4571
4636
|
markDirty();
|
|
@@ -4574,7 +4639,7 @@ function useSectionOperations(input) {
|
|
|
4574
4639
|
);
|
|
4575
4640
|
const renameSection2 = react.useCallback(
|
|
4576
4641
|
(sectionId, newName) => {
|
|
4577
|
-
const result =
|
|
4642
|
+
const result = chunkV32F4I45_js.renameSection(sections, slides, sectionId, newName);
|
|
4578
4643
|
setSections(result.sections);
|
|
4579
4644
|
setSlides(result.slides);
|
|
4580
4645
|
markDirty();
|
|
@@ -4583,7 +4648,7 @@ function useSectionOperations(input) {
|
|
|
4583
4648
|
);
|
|
4584
4649
|
const deleteSection2 = react.useCallback(
|
|
4585
4650
|
(sectionId) => {
|
|
4586
|
-
const result =
|
|
4651
|
+
const result = chunkV32F4I45_js.deleteSection(sections, slides, sectionId);
|
|
4587
4652
|
setSections(result.sections);
|
|
4588
4653
|
setSlides(result.slides);
|
|
4589
4654
|
markDirty();
|
|
@@ -4592,21 +4657,21 @@ function useSectionOperations(input) {
|
|
|
4592
4657
|
);
|
|
4593
4658
|
const moveSectionUp2 = react.useCallback(
|
|
4594
4659
|
(sectionId) => {
|
|
4595
|
-
setSections(
|
|
4660
|
+
setSections(chunkV32F4I45_js.moveSectionUp(sections, sectionId));
|
|
4596
4661
|
markDirty();
|
|
4597
4662
|
},
|
|
4598
4663
|
[sections, setSections, markDirty]
|
|
4599
4664
|
);
|
|
4600
4665
|
const moveSectionDown2 = react.useCallback(
|
|
4601
4666
|
(sectionId) => {
|
|
4602
|
-
setSections(
|
|
4667
|
+
setSections(chunkV32F4I45_js.moveSectionDown(sections, sectionId));
|
|
4603
4668
|
markDirty();
|
|
4604
4669
|
},
|
|
4605
4670
|
[sections, setSections, markDirty]
|
|
4606
4671
|
);
|
|
4607
4672
|
const moveSlidesToSection2 = react.useCallback(
|
|
4608
4673
|
(slideIndexes, targetSectionId) => {
|
|
4609
|
-
const result =
|
|
4674
|
+
const result = chunkV32F4I45_js.moveSlidesToSection(sections, slides, slideIndexes, targetSectionId);
|
|
4610
4675
|
setSlides(result.slides);
|
|
4611
4676
|
setSections(result.sections);
|
|
4612
4677
|
markDirty();
|
|
@@ -4672,15 +4737,15 @@ function syncSelectionHandleOverlay(elementNode, elementId, geometry) {
|
|
|
4672
4737
|
// src/viewer/hooks/pointer-move-handlers.ts
|
|
4673
4738
|
function computeResizeGeometry(handle, startX, startY, startWidth, startHeight, dx, dy, snapToGrid, gridSpacingPx, lockAspect = false) {
|
|
4674
4739
|
const startBox = { x: startX, y: startY, width: startWidth, height: startHeight };
|
|
4675
|
-
let resized =
|
|
4740
|
+
let resized = chunkV32F4I45_js.applyResize(startBox, handle, dx, dy, 1, { minSize: chunkLJ46KXUV_js.MIN_ELEMENT_SIZE });
|
|
4676
4741
|
if (lockAspect) {
|
|
4677
|
-
resized =
|
|
4742
|
+
resized = chunkV32F4I45_js.lockResizeAspect(resized, startBox, handle, chunkLJ46KXUV_js.MIN_ELEMENT_SIZE);
|
|
4678
4743
|
}
|
|
4679
4744
|
const box = { x: resized.x, y: resized.y, width: resized.width, height: resized.height };
|
|
4680
4745
|
if (!snapToGrid) {
|
|
4681
4746
|
return box;
|
|
4682
4747
|
}
|
|
4683
|
-
return
|
|
4748
|
+
return chunkV32F4I45_js.snapBoxToGrid(box, handle, gridSpacingPx, chunkLJ46KXUV_js.MIN_ELEMENT_SIZE);
|
|
4684
4749
|
}
|
|
4685
4750
|
function resolveLiveTarget(input) {
|
|
4686
4751
|
const { livePatcher, editTemplateMode, activeSlide } = input;
|
|
@@ -4793,7 +4858,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4793
4858
|
width: el.width,
|
|
4794
4859
|
height: el.height
|
|
4795
4860
|
}));
|
|
4796
|
-
const snapResult =
|
|
4861
|
+
const snapResult = chunkV32F4I45_js.computeSnapToShape(
|
|
4797
4862
|
targetX,
|
|
4798
4863
|
targetY,
|
|
4799
4864
|
primaryEl.width,
|
|
@@ -4835,7 +4900,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4835
4900
|
if (live) {
|
|
4836
4901
|
for (const id of Object.keys(drag.startPositionsById)) {
|
|
4837
4902
|
const start = drag.startPositionsById[id];
|
|
4838
|
-
|
|
4903
|
+
chunkV32F4I45_js.publishLiveGeometry(live.patcher, live.slideId, id, {
|
|
4839
4904
|
x: start.x + appliedDx,
|
|
4840
4905
|
y: start.y + appliedDy
|
|
4841
4906
|
});
|
|
@@ -4867,8 +4932,8 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4867
4932
|
rs.lastY = geo.y;
|
|
4868
4933
|
rs.lastWidth = geo.width;
|
|
4869
4934
|
rs.lastHeight = geo.height;
|
|
4870
|
-
const width = Math.max(geo.width,
|
|
4871
|
-
const height = Math.max(geo.height,
|
|
4935
|
+
const width = Math.max(geo.width, chunkLJ46KXUV_js.MIN_ELEMENT_SIZE);
|
|
4936
|
+
const height = Math.max(geo.height, chunkLJ46KXUV_js.MIN_ELEMENT_SIZE);
|
|
4872
4937
|
if (rs.domEl) {
|
|
4873
4938
|
rs.domEl.style.left = `${geo.x}px`;
|
|
4874
4939
|
rs.domEl.style.top = `${geo.y}px`;
|
|
@@ -4877,7 +4942,7 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4877
4942
|
syncSelectionHandleOverlay(rs.domEl, rs.elementId, { x: geo.x, y: geo.y, width, height });
|
|
4878
4943
|
}
|
|
4879
4944
|
if (live) {
|
|
4880
|
-
|
|
4945
|
+
chunkV32F4I45_js.publishLiveGeometry(live.patcher, live.slideId, rs.elementId, {
|
|
4881
4946
|
x: geo.x,
|
|
4882
4947
|
y: geo.y,
|
|
4883
4948
|
width,
|
|
@@ -4888,7 +4953,7 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4888
4953
|
function processAdjustmentMove(e, adj, editorScale, updateElementById) {
|
|
4889
4954
|
const dx = (e.clientX - adj.startClientX) / editorScale;
|
|
4890
4955
|
const dy = (e.clientY - adj.startClientY) / editorScale;
|
|
4891
|
-
const adjustments =
|
|
4956
|
+
const adjustments = chunkV32F4I45_js.getDraggedShapeAdjustments(adj, dx, dy);
|
|
4892
4957
|
if (!adj.moved && Math.hypot(dx, dy) > 2) {
|
|
4893
4958
|
adj.moved = true;
|
|
4894
4959
|
}
|
|
@@ -4963,13 +5028,13 @@ function processPointerUp(input) {
|
|
|
4963
5028
|
if (i !== activeSlideIndex) {
|
|
4964
5029
|
return s;
|
|
4965
5030
|
}
|
|
4966
|
-
const rerouted =
|
|
5031
|
+
const rerouted = chunkV32F4I45_js.rerouteConnectorsForMovedElements(s.elements, movedIds);
|
|
4967
5032
|
if (rerouted.length === 0) {
|
|
4968
5033
|
return s;
|
|
4969
5034
|
}
|
|
4970
5035
|
return {
|
|
4971
5036
|
...s,
|
|
4972
|
-
elements:
|
|
5037
|
+
elements: chunkV32F4I45_js.applyReroutedConnectors(s.elements, rerouted)
|
|
4973
5038
|
};
|
|
4974
5039
|
})
|
|
4975
5040
|
);
|
|
@@ -4996,9 +5061,9 @@ function processPointerUp(input) {
|
|
|
4996
5061
|
}
|
|
4997
5062
|
function commitMarquee(marquee, editTemplateMode, templateElements, activeSlide, applySelection, clearSelection) {
|
|
4998
5063
|
const sourceElements = editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4999
|
-
const hitIds =
|
|
5064
|
+
const hitIds = chunkV32F4I45_js.computeMarqueeHitIds(marquee, sourceElements);
|
|
5000
5065
|
if (marquee.additive) {
|
|
5001
|
-
const merged =
|
|
5066
|
+
const merged = chunkV32F4I45_js.mergeAdditiveSelection(marquee.baseSelectionIds, hitIds);
|
|
5002
5067
|
if (merged.length > 0) {
|
|
5003
5068
|
applySelection(merged[0], merged);
|
|
5004
5069
|
} else {
|
|
@@ -5021,8 +5086,8 @@ function commitDrag(drag, editTemplateMode, activeSlide, activeSlideIndex, setTe
|
|
|
5021
5086
|
}
|
|
5022
5087
|
return { ...el, x: start.x + dx, y: start.y + dy };
|
|
5023
5088
|
});
|
|
5024
|
-
const rerouted =
|
|
5025
|
-
return
|
|
5089
|
+
const rerouted = chunkV32F4I45_js.rerouteConnectorsForMovedElements(movedElements, movedIds);
|
|
5090
|
+
return chunkV32F4I45_js.applyReroutedConnectors(movedElements, rerouted);
|
|
5026
5091
|
};
|
|
5027
5092
|
if (editTemplateMode) {
|
|
5028
5093
|
const slideId = activeSlide?.id;
|
|
@@ -5178,17 +5243,17 @@ function useCanvasInteractions(input) {
|
|
|
5178
5243
|
return;
|
|
5179
5244
|
}
|
|
5180
5245
|
const el = elementLookup.get(editId);
|
|
5181
|
-
if (el &&
|
|
5246
|
+
if (el && chunkV32F4I45_js.hasTextProperties(el)) {
|
|
5182
5247
|
const committedText = transformCommittedText ? transformCommittedText(inlineEditingText) : inlineEditingText;
|
|
5183
|
-
const textPatch =
|
|
5248
|
+
const textPatch = chunkV32F4I45_js.buildInlineTextCommitPatch(el, committedText);
|
|
5184
5249
|
if (!textPatch) {
|
|
5185
5250
|
setInlineEditingElementId(null);
|
|
5186
5251
|
setInlineEditingText("");
|
|
5187
5252
|
return;
|
|
5188
5253
|
}
|
|
5189
5254
|
const editorEl = document.querySelector("[data-inline-editor]");
|
|
5190
|
-
const newHeight =
|
|
5191
|
-
const shrink =
|
|
5255
|
+
const newHeight = chunkV32F4I45_js.resolveInlineEditAutoFitHeight(el.textStyle, el.height, editorEl);
|
|
5256
|
+
const shrink = chunkV32F4I45_js.resolveInlineEditNormAutofitShrink(el.textStyle, el.height, editorEl);
|
|
5192
5257
|
ops.updateElementById(editId, {
|
|
5193
5258
|
...textPatch,
|
|
5194
5259
|
...newHeight !== void 0 ? { height: newHeight } : {},
|
|
@@ -5206,7 +5271,7 @@ function useCanvasInteractions(input) {
|
|
|
5206
5271
|
setInlineEditingText("");
|
|
5207
5272
|
};
|
|
5208
5273
|
const openEquationEditorForElement = (el) => {
|
|
5209
|
-
if (!
|
|
5274
|
+
if (!chunkV32F4I45_js.hasTextProperties(el)) {
|
|
5210
5275
|
return false;
|
|
5211
5276
|
}
|
|
5212
5277
|
const eqSeg = el.textSegments?.find((seg) => seg.equationXml);
|
|
@@ -5236,7 +5301,7 @@ function useCanvasInteractions(input) {
|
|
|
5236
5301
|
justInteractedRef.current = false;
|
|
5237
5302
|
} else {
|
|
5238
5303
|
const el = elementLookup.get(elementId);
|
|
5239
|
-
if (el &&
|
|
5304
|
+
if (el && chunkV32F4I45_js.hasTextProperties(el) && chunkV32F4I45_js.canInteractWithElement(el, "textEdit")) {
|
|
5240
5305
|
if (!openEquationEditorForElement(el)) {
|
|
5241
5306
|
setInlineEditingElementId(elementId);
|
|
5242
5307
|
setInlineEditingText(el.text ?? "");
|
|
@@ -5255,7 +5320,7 @@ function useCanvasInteractions(input) {
|
|
|
5255
5320
|
if (openEquationEditorForElement(el)) {
|
|
5256
5321
|
return;
|
|
5257
5322
|
}
|
|
5258
|
-
if (
|
|
5323
|
+
if (chunkV32F4I45_js.hasTextProperties(el) && chunkV32F4I45_js.canInteractWithElement(el, "textEdit")) {
|
|
5259
5324
|
setInlineEditingElementId(elementId);
|
|
5260
5325
|
setInlineEditingText(el.text ?? "");
|
|
5261
5326
|
}
|
|
@@ -5278,7 +5343,7 @@ function useCanvasInteractions(input) {
|
|
|
5278
5343
|
justSelectedRef.current = false;
|
|
5279
5344
|
}
|
|
5280
5345
|
const ids = !wasSelected ? [elementId] : effectiveSelectedIds.length ? effectiveSelectedIds : [elementId];
|
|
5281
|
-
const movableIds =
|
|
5346
|
+
const movableIds = chunkV32F4I45_js.filterInteractableIds(ids, (id) => elementLookup.get(id), "move");
|
|
5282
5347
|
if (movableIds.length === 0) {
|
|
5283
5348
|
return;
|
|
5284
5349
|
}
|
|
@@ -5348,7 +5413,7 @@ function useCanvasInteractions(input) {
|
|
|
5348
5413
|
const handleResizePointerDown = (elementId, e, handle) => {
|
|
5349
5414
|
e.stopPropagation();
|
|
5350
5415
|
const el = elementLookup.get(elementId);
|
|
5351
|
-
if (!el || !
|
|
5416
|
+
if (!el || !chunkV32F4I45_js.canInteractWithElement(el, "resize")) {
|
|
5352
5417
|
return;
|
|
5353
5418
|
}
|
|
5354
5419
|
resizeStateRef.current = {
|
|
@@ -5370,7 +5435,7 @@ function useCanvasInteractions(input) {
|
|
|
5370
5435
|
};
|
|
5371
5436
|
const handleRotate = (elementId, rotationDeg) => {
|
|
5372
5437
|
const el = elementLookup.get(elementId);
|
|
5373
|
-
if (!el || !
|
|
5438
|
+
if (!el || !chunkV32F4I45_js.canInteractWithElement(el, "rotate")) {
|
|
5374
5439
|
return;
|
|
5375
5440
|
}
|
|
5376
5441
|
ops.updateElementById(elementId, { rotation: rotationDeg });
|
|
@@ -5390,10 +5455,10 @@ function useCanvasInteractions(input) {
|
|
|
5390
5455
|
const handleAdjustmentPointerDown = (elementId, e, descriptor) => {
|
|
5391
5456
|
e.stopPropagation();
|
|
5392
5457
|
const el = elementLookup.get(elementId);
|
|
5393
|
-
if (!el || !
|
|
5458
|
+
if (!el || !chunkV32F4I45_js.canInteractWithElement(el, "adjustHandle")) {
|
|
5394
5459
|
return;
|
|
5395
5460
|
}
|
|
5396
|
-
shapeAdjustmentDragStateRef.current =
|
|
5461
|
+
shapeAdjustmentDragStateRef.current = chunkV32F4I45_js.beginShapeAdjustment(
|
|
5397
5462
|
el,
|
|
5398
5463
|
descriptor,
|
|
5399
5464
|
e.clientX,
|
|
@@ -5440,7 +5505,7 @@ function createFileHandlers(deps) {
|
|
|
5440
5505
|
h = Math.round(h * scale);
|
|
5441
5506
|
}
|
|
5442
5507
|
addElement({
|
|
5443
|
-
id:
|
|
5508
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
5444
5509
|
type: "image",
|
|
5445
5510
|
x: Math.round((canvasSize.width - w) / 2),
|
|
5446
5511
|
y: Math.round((canvasSize.height - h) / 2),
|
|
@@ -5451,7 +5516,7 @@ function createFileHandlers(deps) {
|
|
|
5451
5516
|
};
|
|
5452
5517
|
img.onerror = () => {
|
|
5453
5518
|
addElement({
|
|
5454
|
-
id:
|
|
5519
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
5455
5520
|
type: "image",
|
|
5456
5521
|
x: 100,
|
|
5457
5522
|
y: 100,
|
|
@@ -5470,14 +5535,14 @@ function createFileHandlers(deps) {
|
|
|
5470
5535
|
return;
|
|
5471
5536
|
}
|
|
5472
5537
|
e.target.value = "";
|
|
5473
|
-
const mediaType =
|
|
5538
|
+
const mediaType = chunkV32F4I45_js.classifyMediaType(file.type);
|
|
5474
5539
|
if (!mediaType) {
|
|
5475
5540
|
return;
|
|
5476
5541
|
}
|
|
5477
5542
|
const elFilePath = file.path;
|
|
5478
5543
|
const insertMediaElement = (mediaSourceUrl, width, height) => {
|
|
5479
5544
|
addElement({
|
|
5480
|
-
id:
|
|
5545
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
5481
5546
|
type: "media",
|
|
5482
5547
|
mediaType,
|
|
5483
5548
|
mediaMimeType: file.type || void 0,
|
|
@@ -5652,13 +5717,13 @@ function createStructuredElementHandlers(deps) {
|
|
|
5652
5717
|
return;
|
|
5653
5718
|
}
|
|
5654
5719
|
addElement({
|
|
5655
|
-
id:
|
|
5720
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
5656
5721
|
type: "smartArt",
|
|
5657
5722
|
x: 100,
|
|
5658
5723
|
y: 120,
|
|
5659
5724
|
width: 600,
|
|
5660
5725
|
height: 340,
|
|
5661
|
-
smartArtData:
|
|
5726
|
+
smartArtData: chunkV32F4I45_js.buildSmartArtPresetData(
|
|
5662
5727
|
layout,
|
|
5663
5728
|
defaultItems,
|
|
5664
5729
|
(i) => `node-${Date.now()}-${i}-${Math.random().toString(36).slice(2, 8)}`
|
|
@@ -5670,7 +5735,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5670
5735
|
return;
|
|
5671
5736
|
}
|
|
5672
5737
|
addElement({
|
|
5673
|
-
id:
|
|
5738
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
5674
5739
|
type: "shape",
|
|
5675
5740
|
x: 120,
|
|
5676
5741
|
y: 200,
|
|
@@ -5708,7 +5773,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5708
5773
|
return;
|
|
5709
5774
|
}
|
|
5710
5775
|
const resolved = resolveHyperlinkEditResult(data);
|
|
5711
|
-
if (resolved.url && !
|
|
5776
|
+
if (resolved.url && !chunkV32F4I45_js.isUrlSafe(resolved.url)) {
|
|
5712
5777
|
return;
|
|
5713
5778
|
}
|
|
5714
5779
|
const actionClick = {
|
|
@@ -5732,7 +5797,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5732
5797
|
const displayText = value || fieldTexts[fieldType] || fieldType;
|
|
5733
5798
|
const fieldGuid = `{${crypto.randomUUID().toUpperCase()}}`;
|
|
5734
5799
|
addElement({
|
|
5735
|
-
id:
|
|
5800
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
5736
5801
|
type: "shape",
|
|
5737
5802
|
x: 120,
|
|
5738
5803
|
y: 200,
|
|
@@ -5754,11 +5819,11 @@ function createStructuredElementHandlers(deps) {
|
|
|
5754
5819
|
if (!activeSlide) {
|
|
5755
5820
|
return;
|
|
5756
5821
|
}
|
|
5757
|
-
const preset =
|
|
5822
|
+
const preset = chunkV32F4I45_js.ACTION_BUTTON_PRESETS.find((p) => p.shapeType === shapeType);
|
|
5758
5823
|
if (!preset) {
|
|
5759
5824
|
return;
|
|
5760
5825
|
}
|
|
5761
|
-
const defaultPptxAction =
|
|
5826
|
+
const defaultPptxAction = chunkV32F4I45_js.elementActionToPptxAction({
|
|
5762
5827
|
trigger: "click",
|
|
5763
5828
|
type: preset.defaultAction
|
|
5764
5829
|
});
|
|
@@ -5767,7 +5832,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5767
5832
|
defaultPptxAction.highlightClick = true;
|
|
5768
5833
|
}
|
|
5769
5834
|
addElement({
|
|
5770
|
-
id:
|
|
5835
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
5771
5836
|
type: "shape",
|
|
5772
5837
|
x: 150,
|
|
5773
5838
|
y: 150,
|
|
@@ -5834,14 +5899,14 @@ function useInsertElements(input) {
|
|
|
5834
5899
|
return;
|
|
5835
5900
|
}
|
|
5836
5901
|
addElement({
|
|
5837
|
-
id:
|
|
5902
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
5838
5903
|
type: "text",
|
|
5839
5904
|
x: 100,
|
|
5840
5905
|
y: 100,
|
|
5841
5906
|
width: 300,
|
|
5842
5907
|
height: 60,
|
|
5843
5908
|
text: "",
|
|
5844
|
-
textStyle: { fontSize:
|
|
5909
|
+
textStyle: { fontSize: chunkLJ46KXUV_js.DEFAULT_TEXT_FONT_SIZE }
|
|
5845
5910
|
});
|
|
5846
5911
|
};
|
|
5847
5912
|
const handleAddShape = () => {
|
|
@@ -5849,7 +5914,7 @@ function useInsertElements(input) {
|
|
|
5849
5914
|
return;
|
|
5850
5915
|
}
|
|
5851
5916
|
addElement({
|
|
5852
|
-
id:
|
|
5917
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
5853
5918
|
type: "shape",
|
|
5854
5919
|
x: 150,
|
|
5855
5920
|
y: 150,
|
|
@@ -5868,15 +5933,15 @@ function useInsertElements(input) {
|
|
|
5868
5933
|
return;
|
|
5869
5934
|
}
|
|
5870
5935
|
addElement({
|
|
5871
|
-
...
|
|
5872
|
-
id:
|
|
5936
|
+
...chunkV32F4I45_js.newTableElement(chunkLJ46KXUV_js.DEFAULT_TABLE_ROWS, chunkLJ46KXUV_js.DEFAULT_TABLE_COLUMNS, 100, 200),
|
|
5937
|
+
id: chunkV32F4I45_js.generateElementId()
|
|
5873
5938
|
});
|
|
5874
5939
|
};
|
|
5875
5940
|
const handleAddChart = (chartKind) => {
|
|
5876
5941
|
if (!activeSlide) {
|
|
5877
5942
|
return;
|
|
5878
5943
|
}
|
|
5879
|
-
addElement(
|
|
5944
|
+
addElement(chunkV32F4I45_js.createDefaultChartElement(chartKind));
|
|
5880
5945
|
};
|
|
5881
5946
|
const structured = createStructuredElementHandlers({
|
|
5882
5947
|
activeSlide,
|
|
@@ -5947,7 +6012,7 @@ function useClipboardHandlers(input) {
|
|
|
5947
6012
|
if (!selectedElement) {
|
|
5948
6013
|
return;
|
|
5949
6014
|
}
|
|
5950
|
-
setClipboardPayload(
|
|
6015
|
+
setClipboardPayload(chunkV32F4I45_js.buildElementClipboardPayload(selectedElement, editTemplateMode));
|
|
5951
6016
|
};
|
|
5952
6017
|
const handleDelete = () => {
|
|
5953
6018
|
const idsToDelete = effectiveSelectedIds;
|
|
@@ -5964,7 +6029,7 @@ function useClipboardHandlers(input) {
|
|
|
5964
6029
|
handleDelete();
|
|
5965
6030
|
};
|
|
5966
6031
|
const insertClone = (source) => {
|
|
5967
|
-
const clone =
|
|
6032
|
+
const clone = chunkV32F4I45_js.cloneElementForPaste(source, { intoTemplate: editTemplateMode });
|
|
5968
6033
|
ops.updateActiveElements((els) => [...els, clone]);
|
|
5969
6034
|
ops.applySelection(clone.id);
|
|
5970
6035
|
history.markDirty();
|
|
@@ -5999,7 +6064,7 @@ function resolveShapePath(el) {
|
|
|
5999
6064
|
return el.pathData;
|
|
6000
6065
|
}
|
|
6001
6066
|
if ("shapeType" in el && typeof el.shapeType === "string") {
|
|
6002
|
-
const clipPath =
|
|
6067
|
+
const clipPath = chunkV32F4I45_js.getPresetShapeClipPath(el.shapeType);
|
|
6003
6068
|
if (clipPath) {
|
|
6004
6069
|
const svgPath = clipPathToSvgPath(clipPath, el.width, el.height);
|
|
6005
6070
|
if (svgPath) {
|
|
@@ -6050,7 +6115,7 @@ function clipPathToSvgPath(clipPath, width, height) {
|
|
|
6050
6115
|
return parts.join(" ");
|
|
6051
6116
|
}
|
|
6052
6117
|
function transformPathToGlobal(pathData, el) {
|
|
6053
|
-
const polys =
|
|
6118
|
+
const polys = chunkV32F4I45_js.svgPathToPolygons(pathData);
|
|
6054
6119
|
if (polys.length === 0) {
|
|
6055
6120
|
return pathData;
|
|
6056
6121
|
}
|
|
@@ -6070,10 +6135,10 @@ function transformPathToGlobal(pathData, el) {
|
|
|
6070
6135
|
y: pt.y * scaleY + el.y
|
|
6071
6136
|
}))
|
|
6072
6137
|
);
|
|
6073
|
-
return
|
|
6138
|
+
return chunkV32F4I45_js.polygonsToSvgPath(transformed);
|
|
6074
6139
|
}
|
|
6075
6140
|
function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
6076
|
-
const polys =
|
|
6141
|
+
const polys = chunkV32F4I45_js.svgPathToPolygons(pathData);
|
|
6077
6142
|
if (polys.length === 0) {
|
|
6078
6143
|
return pathData;
|
|
6079
6144
|
}
|
|
@@ -6083,10 +6148,10 @@ function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
|
6083
6148
|
y: pt.y - y
|
|
6084
6149
|
}))
|
|
6085
6150
|
);
|
|
6086
|
-
return
|
|
6151
|
+
return chunkV32F4I45_js.polygonsToSvgPath(transformed);
|
|
6087
6152
|
}
|
|
6088
6153
|
function pathBounds(pathData) {
|
|
6089
|
-
const polys =
|
|
6154
|
+
const polys = chunkV32F4I45_js.svgPathToPolygons(pathData);
|
|
6090
6155
|
let minX = Infinity;
|
|
6091
6156
|
let minY = Infinity;
|
|
6092
6157
|
let maxX = -Infinity;
|
|
@@ -6145,7 +6210,7 @@ function useMergeShapesHandler(input) {
|
|
|
6145
6210
|
let allFragments = [];
|
|
6146
6211
|
let remaining = globalPaths[0];
|
|
6147
6212
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
6148
|
-
const frags =
|
|
6213
|
+
const frags = chunkV32F4I45_js.mergeShapes("fragment", remaining, globalPaths[i]);
|
|
6149
6214
|
if (Array.isArray(frags)) {
|
|
6150
6215
|
allFragments = frags;
|
|
6151
6216
|
}
|
|
@@ -6174,7 +6239,7 @@ function useMergeShapesHandler(input) {
|
|
|
6174
6239
|
bounds.height
|
|
6175
6240
|
);
|
|
6176
6241
|
const newEl = {
|
|
6177
|
-
id:
|
|
6242
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
6178
6243
|
type: "shape",
|
|
6179
6244
|
x: bounds.x,
|
|
6180
6245
|
y: bounds.y,
|
|
@@ -6212,7 +6277,7 @@ function useMergeShapesHandler(input) {
|
|
|
6212
6277
|
} else {
|
|
6213
6278
|
let resultPath = globalPaths[0];
|
|
6214
6279
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
6215
|
-
const result =
|
|
6280
|
+
const result = chunkV32F4I45_js.mergeShapes(operation, resultPath, globalPaths[i]);
|
|
6216
6281
|
if (typeof result === "string") {
|
|
6217
6282
|
resultPath = result;
|
|
6218
6283
|
}
|
|
@@ -6233,7 +6298,7 @@ function useMergeShapesHandler(input) {
|
|
|
6233
6298
|
);
|
|
6234
6299
|
const primary = targets[0];
|
|
6235
6300
|
const newEl = {
|
|
6236
|
-
id:
|
|
6301
|
+
id: chunkV32F4I45_js.generateElementId(),
|
|
6237
6302
|
type: "shape",
|
|
6238
6303
|
x: bounds.x,
|
|
6239
6304
|
y: bounds.y,
|
|
@@ -6287,19 +6352,32 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6287
6352
|
effectiveSelectedIds,
|
|
6288
6353
|
selectedElements,
|
|
6289
6354
|
elementLookup,
|
|
6355
|
+
canvasSize,
|
|
6356
|
+
editTemplateMode = false,
|
|
6290
6357
|
setSelectedElementIds,
|
|
6291
6358
|
ops,
|
|
6292
6359
|
history
|
|
6293
6360
|
} = input;
|
|
6361
|
+
const updateElementsOwning = (elementId, updater) => {
|
|
6362
|
+
if (editTemplateMode && !chunkV32F4I45_js.isTemplateElementId(elementId)) {
|
|
6363
|
+
ops.updateSlides(
|
|
6364
|
+
(prev) => prev.map(
|
|
6365
|
+
(slide, index) => index === activeSlideIndex ? { ...slide, elements: updater(slide.elements) } : slide
|
|
6366
|
+
)
|
|
6367
|
+
);
|
|
6368
|
+
return;
|
|
6369
|
+
}
|
|
6370
|
+
ops.updateActiveElements(updater);
|
|
6371
|
+
};
|
|
6294
6372
|
const handleGroupElements = () => {
|
|
6295
6373
|
const ids = effectiveSelectedIds;
|
|
6296
6374
|
if (ids.length < 2 || !activeSlide) {
|
|
6297
6375
|
return;
|
|
6298
6376
|
}
|
|
6299
|
-
if (!selectedElements.every((el) =>
|
|
6377
|
+
if (!selectedElements.every((el) => chunkV32F4I45_js.canInteractWithElement(el, "group"))) {
|
|
6300
6378
|
return;
|
|
6301
6379
|
}
|
|
6302
|
-
const { elements, groupId } =
|
|
6380
|
+
const { elements, groupId } = chunkV32F4I45_js.groupElements(ops.activeElements, ids, chunkV32F4I45_js.generateElementId());
|
|
6303
6381
|
if (groupId === null) {
|
|
6304
6382
|
return;
|
|
6305
6383
|
}
|
|
@@ -6311,15 +6389,15 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6311
6389
|
if (!selectedElement || selectedElement.type !== "group" || !activeSlide) {
|
|
6312
6390
|
return;
|
|
6313
6391
|
}
|
|
6314
|
-
if (!
|
|
6392
|
+
if (!chunkV32F4I45_js.canInteractWithElement(selectedElement, "group")) {
|
|
6315
6393
|
return;
|
|
6316
6394
|
}
|
|
6317
6395
|
const group = selectedElement;
|
|
6318
|
-
const intoTemplate =
|
|
6396
|
+
const intoTemplate = chunkV32F4I45_js.isTemplateElementId(group.id);
|
|
6319
6397
|
const childIds = group.children.map(
|
|
6320
|
-
(child) => intoTemplate ?
|
|
6398
|
+
(child) => intoTemplate ? chunkV32F4I45_js.makeCloneId(true, child.id || group.id) : child.id || chunkV32F4I45_js.generateElementId()
|
|
6321
6399
|
);
|
|
6322
|
-
const { elements, childIds: usedIds } =
|
|
6400
|
+
const { elements, childIds: usedIds } = chunkV32F4I45_js.ungroupElements(
|
|
6323
6401
|
ops.activeElements,
|
|
6324
6402
|
group.id,
|
|
6325
6403
|
childIds,
|
|
@@ -6341,14 +6419,11 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6341
6419
|
history.markDirty();
|
|
6342
6420
|
};
|
|
6343
6421
|
const handleAlignElements = (align) => {
|
|
6344
|
-
if (selectedElements.length < 2) {
|
|
6345
|
-
return;
|
|
6346
|
-
}
|
|
6347
6422
|
const edge = ALIGN_EDGE_BY_KEY[align];
|
|
6348
|
-
if (!edge) {
|
|
6423
|
+
if (!edge || selectedElements.length === 0) {
|
|
6349
6424
|
return;
|
|
6350
6425
|
}
|
|
6351
|
-
const positions =
|
|
6426
|
+
const positions = chunkV32F4I45_js.alignElements(selectedElements, edge, { slideSize: canvasSize });
|
|
6352
6427
|
for (const [id, pos] of positions) {
|
|
6353
6428
|
const el = elementLookup.get(id);
|
|
6354
6429
|
if (!el) {
|
|
@@ -6366,7 +6441,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6366
6441
|
if (!distAxis) {
|
|
6367
6442
|
return;
|
|
6368
6443
|
}
|
|
6369
|
-
const positions =
|
|
6444
|
+
const positions = chunkV32F4I45_js.distributeElements(selectedElements, distAxis);
|
|
6370
6445
|
for (const [id, pos] of positions) {
|
|
6371
6446
|
const el = elementLookup.get(id);
|
|
6372
6447
|
if (!el) {
|
|
@@ -6377,14 +6452,15 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6377
6452
|
history.markDirty();
|
|
6378
6453
|
};
|
|
6379
6454
|
const canDistribute = selectedElements.length >= 3;
|
|
6380
|
-
const selectionGroupable = selectedElements.every((el) =>
|
|
6455
|
+
const selectionGroupable = selectedElements.every((el) => chunkV32F4I45_js.canInteractWithElement(el, "group"));
|
|
6381
6456
|
const handleMoveLayer = (direction) => {
|
|
6382
6457
|
if (!selectedElement || !activeSlide) {
|
|
6383
6458
|
return;
|
|
6384
6459
|
}
|
|
6385
6460
|
const id = selectedElement.id;
|
|
6386
|
-
|
|
6387
|
-
|
|
6461
|
+
updateElementsOwning(
|
|
6462
|
+
id,
|
|
6463
|
+
(els) => direction === "forward" ? chunkV32F4I45_js.bringForward(els, id) : direction === "backward" ? chunkV32F4I45_js.sendBackward(els, id) : els
|
|
6388
6464
|
);
|
|
6389
6465
|
history.markDirty();
|
|
6390
6466
|
};
|
|
@@ -6393,8 +6469,9 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6393
6469
|
return;
|
|
6394
6470
|
}
|
|
6395
6471
|
const id = selectedElement.id;
|
|
6396
|
-
|
|
6397
|
-
|
|
6472
|
+
updateElementsOwning(
|
|
6473
|
+
id,
|
|
6474
|
+
(els) => direction === "front" ? chunkV32F4I45_js.bringToFront(els, id) : chunkV32F4I45_js.sendToBack(els, id)
|
|
6398
6475
|
);
|
|
6399
6476
|
history.markDirty();
|
|
6400
6477
|
};
|
|
@@ -6529,7 +6606,7 @@ function useSlideManagement(input) {
|
|
|
6529
6606
|
} = input;
|
|
6530
6607
|
const handleAddSlideAfter = (afterIndex) => {
|
|
6531
6608
|
const insertAt = Math.max(0, Math.min(afterIndex + 1, slides.length));
|
|
6532
|
-
const newSlide =
|
|
6609
|
+
const newSlide = chunkV32F4I45_js.createBlankSlide(slides.length + 1);
|
|
6533
6610
|
ops.updateSlides((prev) => {
|
|
6534
6611
|
const next = [...prev];
|
|
6535
6612
|
next.splice(insertAt, 0, newSlide);
|
|
@@ -6593,7 +6670,7 @@ function useSlideManagement(input) {
|
|
|
6593
6670
|
}
|
|
6594
6671
|
const clone = {
|
|
6595
6672
|
...src,
|
|
6596
|
-
id:
|
|
6673
|
+
id: chunkV32F4I45_js.makeSlideId(),
|
|
6597
6674
|
elements: src.elements.map((el) => ({
|
|
6598
6675
|
...el,
|
|
6599
6676
|
id: `${el.id}-dup-${Math.random().toString(36).slice(2, 6)}`
|
|
@@ -6625,7 +6702,7 @@ function useSlideManagement(input) {
|
|
|
6625
6702
|
const handleInsertSlideFromLayout = (layoutPath, layoutName) => {
|
|
6626
6703
|
const insertAt = activeSlideIndex + 1;
|
|
6627
6704
|
const draft = {
|
|
6628
|
-
...
|
|
6705
|
+
...chunkV32F4I45_js.createBlankSlide(slides.length + 1),
|
|
6629
6706
|
layoutPath,
|
|
6630
6707
|
...layoutName ? { layoutName } : {}
|
|
6631
6708
|
};
|
|
@@ -6658,9 +6735,9 @@ function useSlideManagement(input) {
|
|
|
6658
6735
|
};
|
|
6659
6736
|
const handleInsertSlideFromTemplate = (templateId) => {
|
|
6660
6737
|
const insertAt = activeSlideIndex + 1;
|
|
6661
|
-
const draft =
|
|
6738
|
+
const draft = chunkV32F4I45_js.buildSlideTemplateSlide(templateId, chunkV32F4I45_js.makeSlideId(), slides.length + 1, {
|
|
6662
6739
|
...canvasSize ? { slideWidth: canvasSize.width, slideHeight: canvasSize.height } : {},
|
|
6663
|
-
scheme:
|
|
6740
|
+
scheme: chunkV32F4I45_js.templateSchemeFromTheme(theme?.colorScheme)
|
|
6664
6741
|
});
|
|
6665
6742
|
ops.updateSlides((prev) => insertSlideFromLayoutUpdater(prev, activeSlideIndex, draft));
|
|
6666
6743
|
setActiveSlideIndex(insertAt);
|
|
@@ -6698,7 +6775,7 @@ function createTableMergeHandlers(input) {
|
|
|
6698
6775
|
if (!nextCell || nextCell.hMerge || nextCell.vMerge) {
|
|
6699
6776
|
return;
|
|
6700
6777
|
}
|
|
6701
|
-
const newTableData =
|
|
6778
|
+
const newTableData = chunkV32F4I45_js.mergeCells(
|
|
6702
6779
|
[
|
|
6703
6780
|
{ row: rowIndex, col: columnIndex },
|
|
6704
6781
|
{ row: rowIndex, col: nextColIdx }
|
|
@@ -6706,7 +6783,7 @@ function createTableMergeHandlers(input) {
|
|
|
6706
6783
|
td
|
|
6707
6784
|
);
|
|
6708
6785
|
const updates = { tableData: newTableData };
|
|
6709
|
-
const newRawXml =
|
|
6786
|
+
const newRawXml = chunkV32F4I45_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6710
6787
|
if (newRawXml) {
|
|
6711
6788
|
updates.rawXml = newRawXml;
|
|
6712
6789
|
}
|
|
@@ -6732,7 +6809,7 @@ function createTableMergeHandlers(input) {
|
|
|
6732
6809
|
if (!targetNextCell || targetNextCell.hMerge || targetNextCell.vMerge) {
|
|
6733
6810
|
return;
|
|
6734
6811
|
}
|
|
6735
|
-
const newTableData =
|
|
6812
|
+
const newTableData = chunkV32F4I45_js.mergeCells(
|
|
6736
6813
|
[
|
|
6737
6814
|
{ row: rowIndex, col: columnIndex },
|
|
6738
6815
|
{ row: targetNextRowIdx, col: columnIndex }
|
|
@@ -6740,7 +6817,7 @@ function createTableMergeHandlers(input) {
|
|
|
6740
6817
|
td
|
|
6741
6818
|
);
|
|
6742
6819
|
const updates = { tableData: newTableData };
|
|
6743
|
-
const newRawXml =
|
|
6820
|
+
const newRawXml = chunkV32F4I45_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6744
6821
|
if (newRawXml) {
|
|
6745
6822
|
updates.rawXml = newRawXml;
|
|
6746
6823
|
}
|
|
@@ -6755,9 +6832,9 @@ function createTableMergeHandlers(input) {
|
|
|
6755
6832
|
return;
|
|
6756
6833
|
}
|
|
6757
6834
|
const td = selectedElement.tableData;
|
|
6758
|
-
const newTableData =
|
|
6835
|
+
const newTableData = chunkV32F4I45_js.mergeCells(ts.selectedCells, td);
|
|
6759
6836
|
const updates = { tableData: newTableData };
|
|
6760
|
-
const newRawXml =
|
|
6837
|
+
const newRawXml = chunkV32F4I45_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6761
6838
|
if (newRawXml) {
|
|
6762
6839
|
updates.rawXml = newRawXml;
|
|
6763
6840
|
}
|
|
@@ -6774,9 +6851,9 @@ function createTableMergeHandlers(input) {
|
|
|
6774
6851
|
}
|
|
6775
6852
|
const { rowIndex, columnIndex } = ts;
|
|
6776
6853
|
const td = selectedElement.tableData;
|
|
6777
|
-
const newTableData =
|
|
6854
|
+
const newTableData = chunkV32F4I45_js.splitCell(rowIndex, columnIndex, td);
|
|
6778
6855
|
const updates = { tableData: newTableData };
|
|
6779
|
-
const newRawXml =
|
|
6856
|
+
const newRawXml = chunkV32F4I45_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6780
6857
|
if (newRawXml) {
|
|
6781
6858
|
updates.rawXml = newRawXml;
|
|
6782
6859
|
}
|
|
@@ -6810,10 +6887,10 @@ function createTableStructHandlers(input) {
|
|
|
6810
6887
|
const text = transformCommittedText ? transformCommittedText(rawText) : rawText;
|
|
6811
6888
|
const updates = {};
|
|
6812
6889
|
if (el.tableData) {
|
|
6813
|
-
updates.tableData =
|
|
6890
|
+
updates.tableData = chunkV32F4I45_js.setCellText(el, rowIndex, colIndex, text).tableData;
|
|
6814
6891
|
}
|
|
6815
6892
|
if (el.rawXml) {
|
|
6816
|
-
const newRawXml =
|
|
6893
|
+
const newRawXml = chunkV32F4I45_js.updateCellTextInRawXml(el, rowIndex, colIndex, text);
|
|
6817
6894
|
if (newRawXml) {
|
|
6818
6895
|
updates.rawXml = newRawXml;
|
|
6819
6896
|
}
|
|
@@ -6837,7 +6914,7 @@ function createTableStructHandlers(input) {
|
|
|
6837
6914
|
const { rowIndex, columnIndex: colIndex } = ts;
|
|
6838
6915
|
const updates = {};
|
|
6839
6916
|
if (selectedElement.rawXml) {
|
|
6840
|
-
const newRawXml =
|
|
6917
|
+
const newRawXml = chunkV32F4I45_js.updateCellTextStyleInRawXml(
|
|
6841
6918
|
selectedElement,
|
|
6842
6919
|
rowIndex,
|
|
6843
6920
|
colIndex,
|
|
@@ -6901,7 +6978,7 @@ function createTableStructHandlers(input) {
|
|
|
6901
6978
|
return;
|
|
6902
6979
|
}
|
|
6903
6980
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6904
|
-
const next =
|
|
6981
|
+
const next = chunkV32F4I45_js.insertTableElementRow(selectedElement, rowIdx, position);
|
|
6905
6982
|
ops.updateSelectedElement({ tableData: next.tableData, rawXml: next.rawXml });
|
|
6906
6983
|
history.markDirty();
|
|
6907
6984
|
};
|
|
@@ -6910,7 +6987,7 @@ function createTableStructHandlers(input) {
|
|
|
6910
6987
|
return;
|
|
6911
6988
|
}
|
|
6912
6989
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6913
|
-
const next =
|
|
6990
|
+
const next = chunkV32F4I45_js.removeTableElementRow(selectedElement, rowIdx);
|
|
6914
6991
|
if (next === selectedElement) {
|
|
6915
6992
|
return;
|
|
6916
6993
|
}
|
|
@@ -6922,7 +6999,7 @@ function createTableStructHandlers(input) {
|
|
|
6922
6999
|
return;
|
|
6923
7000
|
}
|
|
6924
7001
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6925
|
-
const next =
|
|
7002
|
+
const next = chunkV32F4I45_js.insertTableElementColumn(selectedElement, colIdx, position);
|
|
6926
7003
|
ops.updateSelectedElement({ tableData: next.tableData, rawXml: next.rawXml });
|
|
6927
7004
|
history.markDirty();
|
|
6928
7005
|
};
|
|
@@ -6931,7 +7008,7 @@ function createTableStructHandlers(input) {
|
|
|
6931
7008
|
return;
|
|
6932
7009
|
}
|
|
6933
7010
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6934
|
-
const next =
|
|
7011
|
+
const next = chunkV32F4I45_js.removeTableElementColumn(selectedElement, colIdx);
|
|
6935
7012
|
if (next === selectedElement) {
|
|
6936
7013
|
return;
|
|
6937
7014
|
}
|
|
@@ -6967,8 +7044,8 @@ async function renderToCanvas(element, options = {}) {
|
|
|
6967
7044
|
return html2canvasPro(element, {
|
|
6968
7045
|
...options,
|
|
6969
7046
|
onclone: async (doc, clonedEl) => {
|
|
6970
|
-
await
|
|
6971
|
-
|
|
7047
|
+
await chunkV32F4I45_js.normalizeColorsForCapture(doc, clonedEl);
|
|
7048
|
+
chunkV32F4I45_js.preprocessCssForCapture(clonedEl);
|
|
6972
7049
|
if (typeof userOnClone === "function") {
|
|
6973
7050
|
userOnClone(doc, clonedEl);
|
|
6974
7051
|
}
|
|
@@ -6998,7 +7075,7 @@ function useExportSaveAs(input) {
|
|
|
6998
7075
|
slideSizeEmu
|
|
6999
7076
|
} = input;
|
|
7000
7077
|
const handleSaveAsFormat = async (format) => {
|
|
7001
|
-
const downloadName =
|
|
7078
|
+
const downloadName = chunkV32F4I45_js.savedPresentationFileName(filePath, format);
|
|
7002
7079
|
try {
|
|
7003
7080
|
const data = await serializeSlides(format);
|
|
7004
7081
|
if (!data) {
|
|
@@ -7006,16 +7083,16 @@ function useExportSaveAs(input) {
|
|
|
7006
7083
|
}
|
|
7007
7084
|
const mimeType = format === "ppt" ? "application/vnd.ms-powerpoint" : "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
7008
7085
|
const blob = new Blob([data], { type: mimeType });
|
|
7009
|
-
|
|
7086
|
+
chunkV32F4I45_js.downloadBlob(blob, downloadName);
|
|
7010
7087
|
} catch (err) {
|
|
7011
7088
|
console.error(`[PowerPointViewer] Save as .${format} failed:`, err);
|
|
7012
7089
|
}
|
|
7013
7090
|
};
|
|
7014
7091
|
const handleExportJson = () => {
|
|
7015
7092
|
const sourceName = filePath ? filePath.replace(/\\/gu, "/").split("/").pop() : void 0;
|
|
7016
|
-
const slideSize =
|
|
7093
|
+
const slideSize = chunkV32F4I45_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size;
|
|
7017
7094
|
const data = {
|
|
7018
|
-
slides:
|
|
7095
|
+
slides: chunkV32F4I45_js.buildSaveSlides(slides, templateElementsBySlideId),
|
|
7019
7096
|
width: canvasSize.width,
|
|
7020
7097
|
height: canvasSize.height,
|
|
7021
7098
|
widthEmu: slideSize.widthEmu,
|
|
@@ -7034,7 +7111,7 @@ function useExportSaveAs(input) {
|
|
|
7034
7111
|
handoutMaster
|
|
7035
7112
|
};
|
|
7036
7113
|
try {
|
|
7037
|
-
|
|
7114
|
+
chunkV32F4I45_js.exportDeckJson(data, sourceName);
|
|
7038
7115
|
} catch (err) {
|
|
7039
7116
|
console.error("[PowerPointViewer] JSON export failed:", err);
|
|
7040
7117
|
}
|
|
@@ -7099,7 +7176,7 @@ function buildRasterOptions(element, scale, backgroundColor, mode) {
|
|
|
7099
7176
|
}
|
|
7100
7177
|
async function renderElementToRaster(element, scale = 2, backgroundColor, mode = "auto") {
|
|
7101
7178
|
const { width, height } = measureNaturalSize(element);
|
|
7102
|
-
return
|
|
7179
|
+
return chunkV32F4I45_js.rasterizeElement(
|
|
7103
7180
|
element,
|
|
7104
7181
|
width,
|
|
7105
7182
|
height,
|
|
@@ -7109,7 +7186,7 @@ async function renderElementToRaster(element, scale = 2, backgroundColor, mode =
|
|
|
7109
7186
|
}
|
|
7110
7187
|
async function renderElementToTiles(element, scale = 2, backgroundColor, mode = "auto") {
|
|
7111
7188
|
const { width, height } = measureNaturalSize(element);
|
|
7112
|
-
return
|
|
7189
|
+
return chunkV32F4I45_js.rasterizeElementTiles(
|
|
7113
7190
|
element,
|
|
7114
7191
|
width,
|
|
7115
7192
|
height,
|
|
@@ -7119,7 +7196,7 @@ async function renderElementToTiles(element, scale = 2, backgroundColor, mode =
|
|
|
7119
7196
|
}
|
|
7120
7197
|
async function renderElementToTiledCanvas(element, scale = 2, backgroundColor, mode = "auto") {
|
|
7121
7198
|
const { width, height } = measureNaturalSize(element);
|
|
7122
|
-
return
|
|
7199
|
+
return chunkV32F4I45_js.rasterizeElementTiledToCanvas(
|
|
7123
7200
|
element,
|
|
7124
7201
|
width,
|
|
7125
7202
|
height,
|
|
@@ -7141,11 +7218,11 @@ function waitForRender(ms = 100) {
|
|
|
7141
7218
|
async function exportSlideToPngBlob(slideElement, options = {}) {
|
|
7142
7219
|
const { scale = 2, backgroundColor } = options;
|
|
7143
7220
|
const result = await renderElementToRaster(slideElement, scale, backgroundColor);
|
|
7144
|
-
return
|
|
7221
|
+
return chunkV32F4I45_js.rasterResultToPngBlob(result);
|
|
7145
7222
|
}
|
|
7146
7223
|
async function exportSlideAsPng(slideElement, slideIndex, options = {}) {
|
|
7147
7224
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
7148
|
-
|
|
7225
|
+
chunkV32F4I45_js.downloadBlob(blob, `slide-${slideIndex + 1}.png`);
|
|
7149
7226
|
}
|
|
7150
7227
|
async function copySlideToClipboard(slideElement, options = {}) {
|
|
7151
7228
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
@@ -7174,13 +7251,13 @@ async function captureAllSlidesAsPngDataUrls(slideStageRef, totalSlides, setActi
|
|
|
7174
7251
|
// src/viewer/utils/export-pdf.ts
|
|
7175
7252
|
function tilesToPdfPage(tilesResult) {
|
|
7176
7253
|
return tilesResult.tiles.map((tile) => ({
|
|
7177
|
-
image:
|
|
7178
|
-
placement:
|
|
7254
|
+
image: chunkV32F4I45_js.canvasToJpegData(tile.canvas),
|
|
7255
|
+
placement: chunkV32F4I45_js.placeTileOnPage(
|
|
7179
7256
|
tile,
|
|
7180
7257
|
tilesResult.fullWidth,
|
|
7181
7258
|
tilesResult.fullHeight,
|
|
7182
|
-
|
|
7183
|
-
|
|
7259
|
+
chunkV32F4I45_js.PDF_SLIDES_PAGE_WIDTH_PT,
|
|
7260
|
+
chunkV32F4I45_js.PDF_SLIDES_PAGE_HEIGHT_PT
|
|
7184
7261
|
)
|
|
7185
7262
|
}));
|
|
7186
7263
|
}
|
|
@@ -7205,10 +7282,10 @@ async function exportAllSlidesAsPdf(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7205
7282
|
onProgress?.(totalSlides, totalSlides);
|
|
7206
7283
|
setActiveSlide(currentSlideIndex);
|
|
7207
7284
|
if (pages.length === 0) {
|
|
7208
|
-
throw new Error(
|
|
7285
|
+
throw new Error(chunkBRJN3ZMG_js.translationsEn["pptx.export.errorNoSlidesPdf"]);
|
|
7209
7286
|
}
|
|
7210
|
-
const pdfBlobUrl =
|
|
7211
|
-
|
|
7287
|
+
const pdfBlobUrl = chunkLJ46KXUV_js.buildPdfFromTiledImageData(pages);
|
|
7288
|
+
chunkV32F4I45_js.downloadDataUrl(pdfBlobUrl, filename);
|
|
7212
7289
|
}
|
|
7213
7290
|
async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, slideNotes, filename = "presentation-notes.pdf", options = {}) {
|
|
7214
7291
|
const { scale = 2, onProgress, signal } = options;
|
|
@@ -7235,10 +7312,10 @@ async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSl
|
|
|
7235
7312
|
onProgress?.(totalSlides, totalSlides);
|
|
7236
7313
|
setActiveSlide(currentSlideIndex);
|
|
7237
7314
|
if (pages.length === 0) {
|
|
7238
|
-
throw new Error(
|
|
7315
|
+
throw new Error(chunkBRJN3ZMG_js.translationsEn["pptx.export.errorNoSlidesNotesPdf"]);
|
|
7239
7316
|
}
|
|
7240
|
-
const pdfDataUrl =
|
|
7241
|
-
|
|
7317
|
+
const pdfDataUrl = chunkLJ46KXUV_js.buildNotesPdf(pages);
|
|
7318
|
+
chunkV32F4I45_js.downloadDataUrl(pdfDataUrl, filename);
|
|
7242
7319
|
}
|
|
7243
7320
|
|
|
7244
7321
|
// src/viewer/utils/export-video.ts
|
|
@@ -7269,7 +7346,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7269
7346
|
}
|
|
7270
7347
|
setActiveSlide(currentSlideIndex);
|
|
7271
7348
|
if (slideCanvases.length === 0) {
|
|
7272
|
-
throw new Error(
|
|
7349
|
+
throw new Error(chunkBRJN3ZMG_js.translationsEn["pptx.export.errorNoSlidesVideo"]);
|
|
7273
7350
|
}
|
|
7274
7351
|
const firstCanvas = slideCanvases[0];
|
|
7275
7352
|
const recordingCanvas = document.createElement("canvas");
|
|
@@ -7277,12 +7354,12 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7277
7354
|
recordingCanvas.height = firstCanvas.height;
|
|
7278
7355
|
const ctx = recordingCanvas.getContext("2d");
|
|
7279
7356
|
if (!ctx) {
|
|
7280
|
-
throw new Error(
|
|
7357
|
+
throw new Error(chunkBRJN3ZMG_js.translationsEn["pptx.export.errorNo2dContext"]);
|
|
7281
7358
|
}
|
|
7282
7359
|
const fps = 30;
|
|
7283
7360
|
const stream = recordingCanvas.captureStream(fps);
|
|
7284
7361
|
const recorder = new MediaRecorder(stream, {
|
|
7285
|
-
mimeType:
|
|
7362
|
+
mimeType: chunkV32F4I45_js.pickSupportedMimeType([...chunkV32F4I45_js.WEBM_MIME_CANDIDATES]),
|
|
7286
7363
|
videoBitsPerSecond: 5e6
|
|
7287
7364
|
});
|
|
7288
7365
|
const chunks = [];
|
|
@@ -7305,8 +7382,8 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7305
7382
|
const duration = slideTimingsMs?.[i] ?? slideDurationMs;
|
|
7306
7383
|
ctx.clearRect(0, 0, recordingCanvas.width, recordingCanvas.height);
|
|
7307
7384
|
ctx.drawImage(slideCanvases[i], 0, 0);
|
|
7308
|
-
const frameInterval =
|
|
7309
|
-
const framesNeeded =
|
|
7385
|
+
const frameInterval = chunkV32F4I45_js.fpsToFrameIntervalMs(fps);
|
|
7386
|
+
const framesNeeded = chunkV32F4I45_js.segmentFrameCount(duration, fps);
|
|
7310
7387
|
for (let f = 0; f < framesNeeded; f++) {
|
|
7311
7388
|
if (signal?.aborted) {
|
|
7312
7389
|
recorder.stop();
|
|
@@ -7326,7 +7403,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7326
7403
|
|
|
7327
7404
|
// src/viewer/utils/export-gif.ts
|
|
7328
7405
|
function frameFromCanvas(canvas, maxSide) {
|
|
7329
|
-
const { width, height } =
|
|
7406
|
+
const { width, height } = chunkV32F4I45_js.clampGifDimensions(canvas.width, canvas.height, maxSide);
|
|
7330
7407
|
let source = canvas;
|
|
7331
7408
|
if (width !== canvas.width || height !== canvas.height) {
|
|
7332
7409
|
const scaled = canvas.ownerDocument.createElement("canvas");
|
|
@@ -7349,7 +7426,7 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7349
7426
|
const {
|
|
7350
7427
|
scale = 0.5,
|
|
7351
7428
|
slideDurationMs = 2e3,
|
|
7352
|
-
maxSide =
|
|
7429
|
+
maxSide = chunkV32F4I45_js.GIF_POST_CAPTURE_MAX_SIDE,
|
|
7353
7430
|
onProgress,
|
|
7354
7431
|
signal
|
|
7355
7432
|
} = options;
|
|
@@ -7374,9 +7451,9 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7374
7451
|
}
|
|
7375
7452
|
setActiveSlide(currentSlideIndex);
|
|
7376
7453
|
if (frames.length === 0) {
|
|
7377
|
-
throw new Error(
|
|
7454
|
+
throw new Error(chunkBRJN3ZMG_js.translationsEn["pptx.export.errorNoSlidesGif"]);
|
|
7378
7455
|
}
|
|
7379
|
-
const gifBytes =
|
|
7456
|
+
const gifBytes = chunkV32F4I45_js.encodeGif(frames, Math.round(slideDurationMs / 10));
|
|
7380
7457
|
onProgress?.(totalSlides, totalSlides);
|
|
7381
7458
|
const buf = new ArrayBuffer(gifBytes.length);
|
|
7382
7459
|
new Uint8Array(buf).set(gifBytes);
|
|
@@ -7430,7 +7507,7 @@ function exportAllSlidesToSvg(data, options = {}) {
|
|
|
7430
7507
|
continue;
|
|
7431
7508
|
}
|
|
7432
7509
|
onProgress?.(processedCount, data.slides.length);
|
|
7433
|
-
let svg =
|
|
7510
|
+
let svg = chunkV32F4I45_js.SvgExporter.exportSlide(slide, data.width, data.height, svgOptions);
|
|
7434
7511
|
if (embedFonts && fontFaces?.length) {
|
|
7435
7512
|
svg = injectFontFaces(svg, fontFaces);
|
|
7436
7513
|
}
|
|
@@ -7482,7 +7559,7 @@ function useExportMediaHandlers(input) {
|
|
|
7482
7559
|
setExportProgress(0);
|
|
7483
7560
|
setExportModalOpen(true);
|
|
7484
7561
|
try {
|
|
7485
|
-
const { scale } =
|
|
7562
|
+
const { scale } = chunkV32F4I45_js.resolveExportCaptureDecision(imageResolutionScale, "video");
|
|
7486
7563
|
const blob = await exportAllSlidesAsVideo(
|
|
7487
7564
|
canvasStageRef,
|
|
7488
7565
|
slides.length,
|
|
@@ -7492,22 +7569,22 @@ function useExportMediaHandlers(input) {
|
|
|
7492
7569
|
scale,
|
|
7493
7570
|
slideDurationMs: 3e3,
|
|
7494
7571
|
onProgress: (current, total) => {
|
|
7495
|
-
setExportProgress(
|
|
7496
|
-
setExportStatusMessage(
|
|
7572
|
+
setExportProgress(chunkV32F4I45_js.slideProgressPercent(current, total, 45));
|
|
7573
|
+
setExportStatusMessage(chunkV32F4I45_js.slideStatusLabel("Capturing", current, total));
|
|
7497
7574
|
},
|
|
7498
7575
|
onRecordProgress: (current, total) => {
|
|
7499
|
-
setExportProgress(
|
|
7500
|
-
setExportStatusMessage(
|
|
7576
|
+
setExportProgress(chunkV32F4I45_js.recordProgressPercent(current, total));
|
|
7577
|
+
setExportStatusMessage(chunkV32F4I45_js.slideStatusLabel("Recording", current, total));
|
|
7501
7578
|
},
|
|
7502
7579
|
signal: abortCtrl.signal
|
|
7503
7580
|
}
|
|
7504
7581
|
);
|
|
7505
|
-
setExportProgress(
|
|
7582
|
+
setExportProgress(chunkV32F4I45_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7506
7583
|
setExportStatusMessage("Saving file...");
|
|
7507
|
-
|
|
7508
|
-
setExportProgress(
|
|
7584
|
+
chunkV32F4I45_js.downloadBlob(blob, "presentation.webm");
|
|
7585
|
+
setExportProgress(chunkV32F4I45_js.EXPORT_DONE_PERCENT);
|
|
7509
7586
|
} catch (err) {
|
|
7510
|
-
if (!
|
|
7587
|
+
if (!chunkV32F4I45_js.isExportAbortError(err)) {
|
|
7511
7588
|
console.error("[PowerPointViewer] Video export failed:", err);
|
|
7512
7589
|
}
|
|
7513
7590
|
} finally {
|
|
@@ -7537,7 +7614,7 @@ function useExportMediaHandlers(input) {
|
|
|
7537
7614
|
setExportProgress(0);
|
|
7538
7615
|
setExportModalOpen(true);
|
|
7539
7616
|
try {
|
|
7540
|
-
const { scale, postCaptureMaxSide } =
|
|
7617
|
+
const { scale, postCaptureMaxSide } = chunkV32F4I45_js.resolveExportCaptureDecision(
|
|
7541
7618
|
imageResolutionScale,
|
|
7542
7619
|
"gif"
|
|
7543
7620
|
);
|
|
@@ -7551,18 +7628,18 @@ function useExportMediaHandlers(input) {
|
|
|
7551
7628
|
maxSide: postCaptureMaxSide,
|
|
7552
7629
|
slideDurationMs: 2e3,
|
|
7553
7630
|
onProgress: (current, total) => {
|
|
7554
|
-
setExportProgress(
|
|
7555
|
-
setExportStatusMessage(
|
|
7631
|
+
setExportProgress(chunkV32F4I45_js.slideProgressPercent(current, total));
|
|
7632
|
+
setExportStatusMessage(chunkV32F4I45_js.slideStatusLabel("Encoding", current, total));
|
|
7556
7633
|
},
|
|
7557
7634
|
signal: abortCtrl.signal
|
|
7558
7635
|
}
|
|
7559
7636
|
);
|
|
7560
|
-
setExportProgress(
|
|
7637
|
+
setExportProgress(chunkV32F4I45_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7561
7638
|
setExportStatusMessage("Saving file...");
|
|
7562
|
-
|
|
7563
|
-
setExportProgress(
|
|
7639
|
+
chunkV32F4I45_js.downloadBlob(blob, "presentation.gif");
|
|
7640
|
+
setExportProgress(chunkV32F4I45_js.EXPORT_DONE_PERCENT);
|
|
7564
7641
|
} catch (err) {
|
|
7565
|
-
if (!
|
|
7642
|
+
if (!chunkV32F4I45_js.isExportAbortError(err)) {
|
|
7566
7643
|
console.error("[PowerPointViewer] GIF export failed:", err);
|
|
7567
7644
|
}
|
|
7568
7645
|
} finally {
|
|
@@ -7688,21 +7765,21 @@ function useExportHandlers(input) {
|
|
|
7688
7765
|
{
|
|
7689
7766
|
scale: imageExportScale,
|
|
7690
7767
|
onProgress: (current, total) => {
|
|
7691
|
-
setExportProgress(
|
|
7692
|
-
setExportStatusMessage(
|
|
7768
|
+
setExportProgress(chunkV32F4I45_js.slideProgressPercent(current, total));
|
|
7769
|
+
setExportStatusMessage(chunkV32F4I45_js.slideStatusLabel("Rendering", current, total));
|
|
7693
7770
|
},
|
|
7694
7771
|
signal: abortCtrl.signal
|
|
7695
7772
|
}
|
|
7696
7773
|
);
|
|
7697
|
-
setExportProgress(
|
|
7774
|
+
setExportProgress(chunkV32F4I45_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7698
7775
|
setExportStatusMessage("Building PDF...");
|
|
7699
7776
|
await new Promise((r) => {
|
|
7700
7777
|
setTimeout(r, 100);
|
|
7701
7778
|
});
|
|
7702
|
-
setExportProgress(
|
|
7779
|
+
setExportProgress(chunkV32F4I45_js.EXPORT_DONE_PERCENT);
|
|
7703
7780
|
setExportStatusMessage("Done!");
|
|
7704
7781
|
} catch (err) {
|
|
7705
|
-
if (!
|
|
7782
|
+
if (!chunkV32F4I45_js.isExportAbortError(err)) {
|
|
7706
7783
|
console.error("[PowerPointViewer] PDF export failed:", err);
|
|
7707
7784
|
}
|
|
7708
7785
|
} finally {
|
|
@@ -7732,21 +7809,21 @@ function useExportHandlers(input) {
|
|
|
7732
7809
|
{
|
|
7733
7810
|
scale: imageExportScale,
|
|
7734
7811
|
onProgress: (current, total) => {
|
|
7735
|
-
setExportProgress(
|
|
7736
|
-
setExportStatusMessage(
|
|
7812
|
+
setExportProgress(chunkV32F4I45_js.slideProgressPercent(current, total));
|
|
7813
|
+
setExportStatusMessage(chunkV32F4I45_js.slideStatusLabel("Rendering", current, total));
|
|
7737
7814
|
},
|
|
7738
7815
|
signal: abortCtrl.signal
|
|
7739
7816
|
}
|
|
7740
7817
|
);
|
|
7741
|
-
setExportProgress(
|
|
7818
|
+
setExportProgress(chunkV32F4I45_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7742
7819
|
setExportStatusMessage("Building PDF...");
|
|
7743
7820
|
await new Promise((r) => {
|
|
7744
7821
|
setTimeout(r, 100);
|
|
7745
7822
|
});
|
|
7746
|
-
setExportProgress(
|
|
7823
|
+
setExportProgress(chunkV32F4I45_js.EXPORT_DONE_PERCENT);
|
|
7747
7824
|
setExportStatusMessage("Done!");
|
|
7748
7825
|
} catch (err) {
|
|
7749
|
-
if (!
|
|
7826
|
+
if (!chunkV32F4I45_js.isExportAbortError(err)) {
|
|
7750
7827
|
console.error("[PowerPointViewer] Notes PDF export failed:", err);
|
|
7751
7828
|
}
|
|
7752
7829
|
} finally {
|
|
@@ -7794,7 +7871,7 @@ function useExportHandlers(input) {
|
|
|
7794
7871
|
exportStatusMessage
|
|
7795
7872
|
};
|
|
7796
7873
|
}
|
|
7797
|
-
var ViewerOptionsContext = react.createContext(
|
|
7874
|
+
var ViewerOptionsContext = react.createContext(chunkV32F4I45_js.DEFAULT_VIEWER_OPTIONS);
|
|
7798
7875
|
function useViewerOptionsContext() {
|
|
7799
7876
|
return react.useContext(ViewerOptionsContext);
|
|
7800
7877
|
}
|
|
@@ -7806,13 +7883,13 @@ function usePrintHandlers(input) {
|
|
|
7806
7883
|
const { t } = reactI18next.useTranslation();
|
|
7807
7884
|
const viewerOptions = useViewerOptionsContext();
|
|
7808
7885
|
const includeHiddenSlides = viewerOptions.advanced.printHiddenSlides;
|
|
7809
|
-
const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) *
|
|
7886
|
+
const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) * chunkV32F4I45_js.resolveImageResolutionScale(viewerOptions);
|
|
7810
7887
|
const handlePrint = () => {
|
|
7811
7888
|
setIsPrintDialogOpen(true);
|
|
7812
7889
|
};
|
|
7813
7890
|
const handlePrintSvg = async (settings) => {
|
|
7814
7891
|
setIsPrintDialogOpen(false);
|
|
7815
|
-
const printWindow =
|
|
7892
|
+
const printWindow = chunkV32F4I45_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7816
7893
|
if (!printWindow) {
|
|
7817
7894
|
console.warn(
|
|
7818
7895
|
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
@@ -7822,9 +7899,9 @@ function usePrintHandlers(input) {
|
|
|
7822
7899
|
if (!pptxData || settings.printWhat !== "slides") {
|
|
7823
7900
|
return runRasterPrint(printWindow, settings);
|
|
7824
7901
|
}
|
|
7825
|
-
const colorFilter =
|
|
7826
|
-
const slideIndices =
|
|
7827
|
-
|
|
7902
|
+
const colorFilter = chunkV32F4I45_js.computeColorFilter(settings.colorMode);
|
|
7903
|
+
const slideIndices = chunkV32F4I45_js.filterHiddenSlideIndices(
|
|
7904
|
+
chunkV32F4I45_js.computeSlideIndices(
|
|
7828
7905
|
settings.slideRange,
|
|
7829
7906
|
activeSlideIndex,
|
|
7830
7907
|
slides.length,
|
|
@@ -7842,22 +7919,22 @@ function usePrintHandlers(input) {
|
|
|
7842
7919
|
printWindow.close();
|
|
7843
7920
|
return;
|
|
7844
7921
|
}
|
|
7845
|
-
const printDoc =
|
|
7922
|
+
const printDoc = chunkV32F4I45_js.buildPrintDocument(svgs, pptxData.width, pptxData.height, {
|
|
7846
7923
|
title: "Slides (Vector)",
|
|
7847
7924
|
orientation: settings.orientation,
|
|
7848
7925
|
colorFilter,
|
|
7849
7926
|
scaleToFit: settings.scaleToFit
|
|
7850
7927
|
});
|
|
7851
|
-
|
|
7928
|
+
chunkV32F4I45_js.finishPrintWindow(printWindow, printDoc);
|
|
7852
7929
|
} catch (err) {
|
|
7853
7930
|
console.warn("[PowerPointViewer] SVG print path failed, falling back to raster:", err);
|
|
7854
7931
|
return runRasterPrint(printWindow, settings);
|
|
7855
7932
|
}
|
|
7856
7933
|
};
|
|
7857
7934
|
const runRasterPrint = async (printWindow, settings) => {
|
|
7858
|
-
const colorFilter =
|
|
7859
|
-
const slideIndices =
|
|
7860
|
-
|
|
7935
|
+
const colorFilter = chunkV32F4I45_js.computeColorFilter(settings.colorMode);
|
|
7936
|
+
const slideIndices = chunkV32F4I45_js.filterHiddenSlideIndices(
|
|
7937
|
+
chunkV32F4I45_js.computeSlideIndices(
|
|
7861
7938
|
settings.slideRange,
|
|
7862
7939
|
activeSlideIndex,
|
|
7863
7940
|
slides.length,
|
|
@@ -7868,11 +7945,11 @@ function usePrintHandlers(input) {
|
|
|
7868
7945
|
includeHiddenSlides
|
|
7869
7946
|
);
|
|
7870
7947
|
if (settings.printWhat === "outline") {
|
|
7871
|
-
|
|
7948
|
+
chunkV32F4I45_js.finishPrintWindow(
|
|
7872
7949
|
printWindow,
|
|
7873
|
-
|
|
7950
|
+
chunkV32F4I45_js.buildPrintHtmlDocument({
|
|
7874
7951
|
title: "Outline",
|
|
7875
|
-
bodyHtml: `<div class="outline-page">${
|
|
7952
|
+
bodyHtml: `<div class="outline-page">${chunkV32F4I45_js.buildOutlineHtml(slideIndices, slides)}</div>`,
|
|
7876
7953
|
orientation: settings.orientation,
|
|
7877
7954
|
colorFilter,
|
|
7878
7955
|
frameSlides: settings.frameSlides,
|
|
@@ -7899,11 +7976,11 @@ function usePrintHandlers(input) {
|
|
|
7899
7976
|
}
|
|
7900
7977
|
const slideImages = slideIndices.map((idx) => allImages[idx]).filter(Boolean);
|
|
7901
7978
|
if (settings.printWhat === "slides") {
|
|
7902
|
-
|
|
7979
|
+
chunkV32F4I45_js.finishPrintWindow(
|
|
7903
7980
|
printWindow,
|
|
7904
|
-
|
|
7981
|
+
chunkV32F4I45_js.buildPrintHtmlDocument({
|
|
7905
7982
|
title: "Slides",
|
|
7906
|
-
bodyHtml:
|
|
7983
|
+
bodyHtml: chunkV32F4I45_js.buildSlidesHtml(slideImages, slideIndices),
|
|
7907
7984
|
orientation: settings.orientation,
|
|
7908
7985
|
colorFilter,
|
|
7909
7986
|
frameSlides: settings.frameSlides,
|
|
@@ -7913,11 +7990,11 @@ function usePrintHandlers(input) {
|
|
|
7913
7990
|
return;
|
|
7914
7991
|
}
|
|
7915
7992
|
if (settings.printWhat === "notes") {
|
|
7916
|
-
|
|
7993
|
+
chunkV32F4I45_js.finishPrintWindow(
|
|
7917
7994
|
printWindow,
|
|
7918
|
-
|
|
7995
|
+
chunkV32F4I45_js.buildPrintHtmlDocument({
|
|
7919
7996
|
title: "Notes Pages",
|
|
7920
|
-
bodyHtml:
|
|
7997
|
+
bodyHtml: chunkV32F4I45_js.buildNotesHtml(slideImages, slideIndices, slides),
|
|
7921
7998
|
orientation: "portrait",
|
|
7922
7999
|
colorFilter,
|
|
7923
8000
|
frameSlides: settings.frameSlides,
|
|
@@ -7928,11 +8005,11 @@ function usePrintHandlers(input) {
|
|
|
7928
8005
|
}
|
|
7929
8006
|
if (settings.printWhat === "handouts") {
|
|
7930
8007
|
const spp = settings.slidesPerPage;
|
|
7931
|
-
|
|
8008
|
+
chunkV32F4I45_js.finishPrintWindow(
|
|
7932
8009
|
printWindow,
|
|
7933
|
-
|
|
8010
|
+
chunkV32F4I45_js.buildPrintHtmlDocument({
|
|
7934
8011
|
title: `Handout ${spp} per page`,
|
|
7935
|
-
bodyHtml:
|
|
8012
|
+
bodyHtml: chunkV32F4I45_js.buildHandoutsHtml(slideImages, slideIndices, spp, pptxData?.handoutMaster),
|
|
7936
8013
|
orientation: "portrait",
|
|
7937
8014
|
colorFilter,
|
|
7938
8015
|
frameSlides: settings.frameSlides,
|
|
@@ -7946,7 +8023,7 @@ function usePrintHandlers(input) {
|
|
|
7946
8023
|
};
|
|
7947
8024
|
const handlePrintWithSettings = async (settings) => {
|
|
7948
8025
|
setIsPrintDialogOpen(false);
|
|
7949
|
-
const printWindow =
|
|
8026
|
+
const printWindow = chunkV32F4I45_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7950
8027
|
if (!printWindow) {
|
|
7951
8028
|
console.warn(
|
|
7952
8029
|
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
@@ -8011,13 +8088,13 @@ function useThemeHandlers(input) {
|
|
|
8011
8088
|
return;
|
|
8012
8089
|
}
|
|
8013
8090
|
await handler.updateThemeColorScheme(colorScheme);
|
|
8014
|
-
const previousMap = theme?.colorScheme ?
|
|
8015
|
-
setSlides((prev) =>
|
|
8091
|
+
const previousMap = theme?.colorScheme ? chunkV32F4I45_js.buildThemeColorMap(theme.colorScheme) : {};
|
|
8092
|
+
setSlides((prev) => chunkV32F4I45_js.reResolveSlideColors(prev, previousMap, colorScheme));
|
|
8016
8093
|
if (Object.keys(templateElementsBySlideId).length > 0) {
|
|
8017
8094
|
setTemplateElementsBySlideId((prev) => {
|
|
8018
8095
|
const next = {};
|
|
8019
8096
|
for (const [slideId, elements] of Object.entries(prev)) {
|
|
8020
|
-
next[slideId] =
|
|
8097
|
+
next[slideId] = chunkV32F4I45_js.reResolveElementColors(elements, previousMap, colorScheme);
|
|
8021
8098
|
}
|
|
8022
8099
|
return next;
|
|
8023
8100
|
});
|
|
@@ -8126,7 +8203,7 @@ function useThemeSwitching(input) {
|
|
|
8126
8203
|
}
|
|
8127
8204
|
try {
|
|
8128
8205
|
await handler.applyTheme(preset.colorScheme, preset.fontScheme, preset.name);
|
|
8129
|
-
const newData =
|
|
8206
|
+
const newData = chunkV32F4I45_js.applyThemeToData(data, preset.colorScheme, preset.fontScheme, preset.name);
|
|
8130
8207
|
onDataChange(newData);
|
|
8131
8208
|
onThemeChanged?.(preset);
|
|
8132
8209
|
} catch (error) {
|
|
@@ -8143,7 +8220,7 @@ function useThemeSwitching(input) {
|
|
|
8143
8220
|
}
|
|
8144
8221
|
try {
|
|
8145
8222
|
await handler.applyTheme(colorScheme, fontScheme ?? {}, themeName);
|
|
8146
|
-
const newData =
|
|
8223
|
+
const newData = chunkV32F4I45_js.applyThemeToData(data, colorScheme, fontScheme, themeName);
|
|
8147
8224
|
onDataChange(newData);
|
|
8148
8225
|
} catch (error) {
|
|
8149
8226
|
console.error("Failed to switch to custom theme:", error);
|
|
@@ -8155,12 +8232,12 @@ function useThemeSwitching(input) {
|
|
|
8155
8232
|
if (!data?.theme?.colorScheme) {
|
|
8156
8233
|
return void 0;
|
|
8157
8234
|
}
|
|
8158
|
-
return
|
|
8159
|
-
(p) =>
|
|
8235
|
+
return chunkV32F4I45_js.THEME_PRESETS.find(
|
|
8236
|
+
(p) => chunkV32F4I45_js.themeColorSchemesEqual(data.theme?.colorScheme, p.colorScheme)
|
|
8160
8237
|
);
|
|
8161
8238
|
}, [data?.theme?.colorScheme]);
|
|
8162
8239
|
return {
|
|
8163
|
-
presets:
|
|
8240
|
+
presets: chunkV32F4I45_js.THEME_PRESETS,
|
|
8164
8241
|
switchToPreset,
|
|
8165
8242
|
switchToCustom,
|
|
8166
8243
|
currentPreset
|
|
@@ -8235,7 +8312,7 @@ function usePropertyHandlers(input) {
|
|
|
8235
8312
|
}
|
|
8236
8313
|
try {
|
|
8237
8314
|
const ab = await file.arrayBuffer();
|
|
8238
|
-
const h = new
|
|
8315
|
+
const h = new chunkV32F4I45_js.PptxHandler();
|
|
8239
8316
|
const other = await h.load(ab);
|
|
8240
8317
|
if (!other) {
|
|
8241
8318
|
return;
|
|
@@ -8245,7 +8322,7 @@ function usePropertyHandlers(input) {
|
|
|
8245
8322
|
width: canvasSize.width,
|
|
8246
8323
|
height: canvasSize.height
|
|
8247
8324
|
};
|
|
8248
|
-
setCompareResult(
|
|
8325
|
+
setCompareResult(chunkV32F4I45_js.comparePresentation(cur, other));
|
|
8249
8326
|
setIsComparePanelOpen(true);
|
|
8250
8327
|
} catch (err) {
|
|
8251
8328
|
console.warn("Compare failed:", err);
|
|
@@ -8262,7 +8339,7 @@ function usePropertyHandlers(input) {
|
|
|
8262
8339
|
if (!diff || diff.status === "unchanged") {
|
|
8263
8340
|
return;
|
|
8264
8341
|
}
|
|
8265
|
-
setSlides((prev) =>
|
|
8342
|
+
setSlides((prev) => chunkV32F4I45_js.applyAcceptSlide(prev, diff));
|
|
8266
8343
|
setIsDirty(true);
|
|
8267
8344
|
},
|
|
8268
8345
|
[compareResult, setSlides, setIsDirty]
|
|
@@ -8273,10 +8350,10 @@ function usePropertyHandlers(input) {
|
|
|
8273
8350
|
if (!compareResult) {
|
|
8274
8351
|
return;
|
|
8275
8352
|
}
|
|
8276
|
-
setSlides((prev) =>
|
|
8353
|
+
setSlides((prev) => chunkV32F4I45_js.applyAcceptAllSlides(prev, compareResult));
|
|
8277
8354
|
setIsDirty(true);
|
|
8278
8355
|
}, [compareResult, setSlides, setIsDirty]);
|
|
8279
|
-
const usedFontFamilies = react.useMemo(() =>
|
|
8356
|
+
const usedFontFamilies = react.useMemo(() => chunkV32F4I45_js.collectUsedFonts(slides), [slides]);
|
|
8280
8357
|
return {
|
|
8281
8358
|
handleUpdateNotes,
|
|
8282
8359
|
handleUpdateSlide,
|
|
@@ -8431,7 +8508,7 @@ function useViewerDialogs(input) {
|
|
|
8431
8508
|
);
|
|
8432
8509
|
const embeddedFontKey = (embeddedFontFamilies ?? []).join("\0");
|
|
8433
8510
|
const fontEmbedding = react.useMemo(
|
|
8434
|
-
() =>
|
|
8511
|
+
() => chunkV32F4I45_js.describeFontEmbedding(embeddedFontKey ? embeddedFontKey.split("\0") : []),
|
|
8435
8512
|
[embeddedFontKey]
|
|
8436
8513
|
);
|
|
8437
8514
|
const [embedFontsEnabled, setEmbedFontsEnabled] = react.useState(fontEmbedding.initialEnabled);
|
|
@@ -8441,11 +8518,11 @@ function useViewerDialogs(input) {
|
|
|
8441
8518
|
setEmbedFontsEnabled(fontEmbedding.initialEnabled);
|
|
8442
8519
|
}
|
|
8443
8520
|
const [isNarrowViewport, setIsNarrowViewport] = react.useState(
|
|
8444
|
-
() => typeof window !== "undefined" ?
|
|
8521
|
+
() => typeof window !== "undefined" ? chunkV32F4I45_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch()) : false
|
|
8445
8522
|
);
|
|
8446
8523
|
react.useEffect(() => {
|
|
8447
8524
|
const handleWindow = () => setIsNarrowViewport(
|
|
8448
|
-
|
|
8525
|
+
chunkV32F4I45_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch())
|
|
8449
8526
|
);
|
|
8450
8527
|
window.addEventListener("resize", handleWindow);
|
|
8451
8528
|
return () => window.removeEventListener("resize", handleWindow);
|
|
@@ -8598,16 +8675,16 @@ function useViewerDialogs(input) {
|
|
|
8598
8675
|
};
|
|
8599
8676
|
}
|
|
8600
8677
|
function computeGridSpacingPx2(documentGridSpacing) {
|
|
8601
|
-
return
|
|
8678
|
+
return chunkV32F4I45_js.computeGridSpacingPx(documentGridSpacing, chunkLJ46KXUV_js.GRID_SIZE);
|
|
8602
8679
|
}
|
|
8603
8680
|
function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows, presentationProperties) {
|
|
8604
8681
|
const activeShow = activeCustomShowId ? customShows.find((show) => show.id === activeCustomShowId) : void 0;
|
|
8605
|
-
const authoredRange =
|
|
8606
|
-
return
|
|
8682
|
+
const authoredRange = chunkV32F4I45_js.resolveAuthoredSlideRange(presentationProperties, slides.length);
|
|
8683
|
+
return chunkV32F4I45_js.resolveShowSlideIndexes(slides, activeShow, authoredRange);
|
|
8607
8684
|
}
|
|
8608
8685
|
function computeSlideSectionGroups(slides, sections) {
|
|
8609
|
-
return
|
|
8610
|
-
id: group.section?.id ?? (sections.length > 0 ?
|
|
8686
|
+
return chunkV32F4I45_js.groupSlidesBySection(sections, slides).map((group) => ({
|
|
8687
|
+
id: group.section?.id ?? (sections.length > 0 ? chunkLJ46KXUV_js.UNGROUPED_SECTION_ID : chunkLJ46KXUV_js.DEFAULT_SECTION_GROUP_ID),
|
|
8611
8688
|
label: group.section?.name ?? (sections.length > 0 ? "Ungrouped Slides" : "Slides"),
|
|
8612
8689
|
slideIndexes: group.slideIndexes,
|
|
8613
8690
|
...group.section?.color !== void 0 ? { color: group.section.color } : {},
|
|
@@ -8619,7 +8696,7 @@ function computeMasterPseudoSlide(mode, activeLayout, activeMaster) {
|
|
|
8619
8696
|
return void 0;
|
|
8620
8697
|
}
|
|
8621
8698
|
const document2 = activeLayout ? { slideMasters: [{ ...activeMaster, layouts: [activeLayout] }] } : { slideMasters: [activeMaster] };
|
|
8622
|
-
return
|
|
8699
|
+
return chunkV32F4I45_js.masterViewPseudoSlide(document2, {
|
|
8623
8700
|
tab: "slides",
|
|
8624
8701
|
masterIndex: 0,
|
|
8625
8702
|
layoutIndex: activeLayout ? 0 : null
|
|
@@ -8647,15 +8724,15 @@ function useDerivedSlideState(input) {
|
|
|
8647
8724
|
[slides, activeCustomShowId, customShows, presentationProperties]
|
|
8648
8725
|
);
|
|
8649
8726
|
const authoredRange = react.useMemo(
|
|
8650
|
-
() =>
|
|
8727
|
+
() => chunkV32F4I45_js.resolveAuthoredSlideRange(presentationProperties, slides.length),
|
|
8651
8728
|
[presentationProperties, slides.length]
|
|
8652
8729
|
);
|
|
8653
8730
|
const slideSectionGroups = react.useMemo(
|
|
8654
8731
|
() => computeSlideSectionGroups(slides, sections).map((group) => {
|
|
8655
|
-
if (group.id ===
|
|
8732
|
+
if (group.id === chunkLJ46KXUV_js.UNGROUPED_SECTION_ID && group.label === "Ungrouped Slides") {
|
|
8656
8733
|
return { ...group, label: t("pptx.slides.ungroupedSlides") };
|
|
8657
8734
|
}
|
|
8658
|
-
if (group.id ===
|
|
8735
|
+
if (group.id === chunkLJ46KXUV_js.DEFAULT_SECTION_GROUP_ID && group.label === "Slides") {
|
|
8659
8736
|
return { ...group, label: t("pptx.sections.slides") };
|
|
8660
8737
|
}
|
|
8661
8738
|
return group;
|
|
@@ -8756,13 +8833,13 @@ function useAnnotationHandlers(input) {
|
|
|
8756
8833
|
}, [annotations, setMode, setSlides, history]);
|
|
8757
8834
|
const handleSetMode = react.useCallback(
|
|
8758
8835
|
(nextMode) => {
|
|
8759
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
8836
|
+
if (mode === "present" && nextMode !== "present" && !chunkV32F4I45_js.mayLeaveSlideShow()) {
|
|
8760
8837
|
return;
|
|
8761
8838
|
}
|
|
8762
8839
|
if (nextMode === "present") {
|
|
8763
8840
|
presentation.enterPresentMode();
|
|
8764
8841
|
} else if (mode === "present" && annotations.hasAnyAnnotations) {
|
|
8765
|
-
|
|
8842
|
+
chunkV32F4I45_js.stopAllPersistentAudio();
|
|
8766
8843
|
if (promptKeepInkAnnotations) {
|
|
8767
8844
|
pendingModeAfterAnnotationsRef.current = nextMode;
|
|
8768
8845
|
setShowKeepAnnotationsDialog(true);
|
|
@@ -8772,7 +8849,7 @@ function useAnnotationHandlers(input) {
|
|
|
8772
8849
|
}
|
|
8773
8850
|
} else {
|
|
8774
8851
|
if (mode === "present") {
|
|
8775
|
-
|
|
8852
|
+
chunkV32F4I45_js.stopAllPersistentAudio();
|
|
8776
8853
|
}
|
|
8777
8854
|
setMode(nextMode);
|
|
8778
8855
|
}
|
|
@@ -8841,13 +8918,13 @@ function useSerialize(input) {
|
|
|
8841
8918
|
let processedSlide = slide;
|
|
8842
8919
|
if (pendingEditId) {
|
|
8843
8920
|
const updatedElements = slide.elements.map((el) => {
|
|
8844
|
-
if (el.id !== pendingEditId || !
|
|
8921
|
+
if (el.id !== pendingEditId || !chunkV32F4I45_js.hasTextProperties(el)) {
|
|
8845
8922
|
return el;
|
|
8846
8923
|
}
|
|
8847
8924
|
return {
|
|
8848
8925
|
...el,
|
|
8849
8926
|
text: pendingEditText,
|
|
8850
|
-
textSegments:
|
|
8927
|
+
textSegments: chunkV32F4I45_js.remapTextToSegments(pendingEditText, el.textSegments, el.textStyle)
|
|
8851
8928
|
};
|
|
8852
8929
|
});
|
|
8853
8930
|
if (updatedElements.some((el, i) => el !== slide.elements[i])) {
|
|
@@ -8860,19 +8937,19 @@ function useSerialize(input) {
|
|
|
8860
8937
|
const pptxGuides = guides.map((g) => ({
|
|
8861
8938
|
id: g.id,
|
|
8862
8939
|
orientation: g.axis === "h" ? "horz" : "vert",
|
|
8863
|
-
positionEmu:
|
|
8940
|
+
positionEmu: chunkV32F4I45_js.guidePxToEmu(g.position)
|
|
8864
8941
|
}));
|
|
8865
8942
|
return {
|
|
8866
8943
|
...processedSlide,
|
|
8867
8944
|
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
8868
8945
|
};
|
|
8869
8946
|
});
|
|
8870
|
-
const slidesToSave =
|
|
8871
|
-
const saveOptions =
|
|
8947
|
+
const slidesToSave = chunkV32F4I45_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
8948
|
+
const saveOptions = chunkV32F4I45_js.buildDeckSaveOptions({
|
|
8872
8949
|
// Without this the Slide Size card edited a viewer-only pixel value and
|
|
8873
8950
|
// the saved `p:sldSz` never moved: passing `slideSize` is the only way a
|
|
8874
8951
|
// slide-size edit reaches the file.
|
|
8875
|
-
slideSize:
|
|
8952
|
+
slideSize: chunkV32F4I45_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size,
|
|
8876
8953
|
headerFooter,
|
|
8877
8954
|
presentationProperties,
|
|
8878
8955
|
viewProperties,
|
|
@@ -8891,7 +8968,7 @@ function useSerialize(input) {
|
|
|
8891
8968
|
embedFonts,
|
|
8892
8969
|
outputFormat: format
|
|
8893
8970
|
});
|
|
8894
|
-
return
|
|
8971
|
+
return chunkV32F4I45_js.saveDeckWithPassword(handler, slidesToSave, saveOptions, { password, purpose });
|
|
8895
8972
|
},
|
|
8896
8973
|
[
|
|
8897
8974
|
slides,
|
|
@@ -8932,7 +9009,7 @@ function useRecoveryDetection(input) {
|
|
|
8932
9009
|
const onRestore = input.onRestore;
|
|
8933
9010
|
const openVersionHistory = input.openVersionHistory;
|
|
8934
9011
|
react.useEffect(() => {
|
|
8935
|
-
if (!
|
|
9012
|
+
if (!chunkV32F4I45_js.shouldProbeAutosaveRecovery({
|
|
8936
9013
|
alreadyChecked: recoveryCheckedRef.current,
|
|
8937
9014
|
filePath,
|
|
8938
9015
|
loading,
|
|
@@ -8944,7 +9021,7 @@ function useRecoveryDetection(input) {
|
|
|
8944
9021
|
}
|
|
8945
9022
|
recoveryCheckedRef.current = true;
|
|
8946
9023
|
void (async () => {
|
|
8947
|
-
const offer = await
|
|
9024
|
+
const offer = await chunkV32F4I45_js.probeAutosaveRecovery(filePath);
|
|
8948
9025
|
if (!offer) {
|
|
8949
9026
|
return;
|
|
8950
9027
|
}
|
|
@@ -8957,7 +9034,7 @@ function useRecoveryDetection(input) {
|
|
|
8957
9034
|
const record = recordRef.current;
|
|
8958
9035
|
setPrompt(null);
|
|
8959
9036
|
if (record && onRestore) {
|
|
8960
|
-
onRestore(
|
|
9037
|
+
onRestore(chunkV32F4I45_js.acceptAutosaveRecovery(record));
|
|
8961
9038
|
}
|
|
8962
9039
|
recordRef.current = null;
|
|
8963
9040
|
}, [onRestore]);
|
|
@@ -8966,7 +9043,7 @@ function useRecoveryDetection(input) {
|
|
|
8966
9043
|
setPrompt(null);
|
|
8967
9044
|
recordRef.current = null;
|
|
8968
9045
|
if (record) {
|
|
8969
|
-
void
|
|
9046
|
+
void chunkV32F4I45_js.discardAutosaveRecovery(record);
|
|
8970
9047
|
}
|
|
8971
9048
|
}, []);
|
|
8972
9049
|
return { prompt, restore, discard };
|
|
@@ -9017,11 +9094,11 @@ function usePresentationSetup(input) {
|
|
|
9017
9094
|
containerRef,
|
|
9018
9095
|
content,
|
|
9019
9096
|
onSetMode: (nextMode) => {
|
|
9020
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
9097
|
+
if (mode === "present" && nextMode !== "present" && !chunkV32F4I45_js.mayLeaveSlideShow()) {
|
|
9021
9098
|
return;
|
|
9022
9099
|
}
|
|
9023
9100
|
if (mode === "present" && nextMode !== "present") {
|
|
9024
|
-
|
|
9101
|
+
chunkV32F4I45_js.stopAllPersistentAudio();
|
|
9025
9102
|
stopAnimationSound();
|
|
9026
9103
|
const exitHandler = exitModeHandlerRef.current;
|
|
9027
9104
|
if (exitHandler) {
|
|
@@ -9089,10 +9166,10 @@ function usePresentationSetup(input) {
|
|
|
9089
9166
|
onToggleToolbar: () => annotations.setToolbarVisible(!annotations.toolbarVisible),
|
|
9090
9167
|
onToggleSubtitles,
|
|
9091
9168
|
onSaveRehearsalTimings: (timings) => {
|
|
9092
|
-
setSlides((prev) =>
|
|
9169
|
+
setSlides((prev) => chunkV32F4I45_js.applyRehearsalTimings(prev, timings));
|
|
9093
9170
|
history.markDirty();
|
|
9094
9171
|
},
|
|
9095
|
-
loopContinuously:
|
|
9172
|
+
loopContinuously: chunkV32F4I45_js.shouldLoopContinuously(presentationProperties),
|
|
9096
9173
|
showWithAnimation: presentationProperties.showWithAnimation,
|
|
9097
9174
|
useTimings: presentationProperties.advanceMode !== "manual",
|
|
9098
9175
|
endWithBlackSlide,
|
|
@@ -9249,6 +9326,7 @@ function useEditorOperations(input) {
|
|
|
9249
9326
|
selectedElementIdSet: state.selectedElementIdSet,
|
|
9250
9327
|
elementLookup: state.elementLookup,
|
|
9251
9328
|
editTemplateMode: state.editTemplateMode,
|
|
9329
|
+
canvasSize,
|
|
9252
9330
|
clipboardPayload: state.clipboardPayload,
|
|
9253
9331
|
setClipboardPayload: state.setClipboardPayload,
|
|
9254
9332
|
setSelectedElementIds: state.setSelectedElementIds,
|
|
@@ -9299,7 +9377,7 @@ function useEditorOperations(input) {
|
|
|
9299
9377
|
const { formatPainterActive, setFormatPainterActive, elementLookup } = state;
|
|
9300
9378
|
react.useEffect(() => {
|
|
9301
9379
|
if (formatPainterActive && !prevFormatPainterRef.current && selectedElement) {
|
|
9302
|
-
copiedFormatRef.current =
|
|
9380
|
+
copiedFormatRef.current = chunkV32F4I45_js.copyFormatFromElement(selectedElement);
|
|
9303
9381
|
} else if (!formatPainterActive) {
|
|
9304
9382
|
copiedFormatRef.current = null;
|
|
9305
9383
|
}
|
|
@@ -9325,12 +9403,12 @@ function useEditorOperations(input) {
|
|
|
9325
9403
|
e.stopPropagation();
|
|
9326
9404
|
const element = elementLookup.get(elementId);
|
|
9327
9405
|
if (element) {
|
|
9328
|
-
const updated =
|
|
9406
|
+
const updated = chunkV32F4I45_js.applyFormatToElement(element, copiedFormatRef.current);
|
|
9329
9407
|
const updates = {};
|
|
9330
|
-
if (
|
|
9408
|
+
if (chunkV32F4I45_js.hasShapeProperties(updated)) {
|
|
9331
9409
|
updates.shapeStyle = updated.shapeStyle;
|
|
9332
9410
|
}
|
|
9333
|
-
if (
|
|
9411
|
+
if (chunkV32F4I45_js.hasTextProperties(updated)) {
|
|
9334
9412
|
updates.textStyle = updated.textStyle;
|
|
9335
9413
|
}
|
|
9336
9414
|
ops.updateElementById(elementId, updates);
|
|
@@ -9516,10 +9594,10 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9516
9594
|
}
|
|
9517
9595
|
};
|
|
9518
9596
|
}, [embeddedFonts]);
|
|
9519
|
-
const referencedFamilies = react.useMemo(() =>
|
|
9597
|
+
const referencedFamilies = react.useMemo(() => chunkV32F4I45_js.collectReferencedFontFamilies(slides), [slides]);
|
|
9520
9598
|
react.useEffect(() => {
|
|
9521
9599
|
let cancelled = false;
|
|
9522
|
-
void
|
|
9600
|
+
void chunkV32F4I45_js.resolveGoogleWebfontHref(slides, embeddedFonts).then((href) => {
|
|
9523
9601
|
if (cancelled) {
|
|
9524
9602
|
return null;
|
|
9525
9603
|
}
|
|
@@ -9544,15 +9622,15 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9544
9622
|
const [, setOutlineFontsTick] = react.useState(0);
|
|
9545
9623
|
react.useEffect(() => {
|
|
9546
9624
|
let cancelled = false;
|
|
9547
|
-
const referenced =
|
|
9548
|
-
const candidates =
|
|
9625
|
+
const referenced = chunkV32F4I45_js.collectReferencedFontFamilies(slides);
|
|
9626
|
+
const candidates = chunkV32F4I45_js.selectGoogleWebfontFamilies(
|
|
9549
9627
|
referenced,
|
|
9550
9628
|
embeddedFonts.map((font) => font.name)
|
|
9551
9629
|
);
|
|
9552
9630
|
if (candidates.length === 0) {
|
|
9553
9631
|
return;
|
|
9554
9632
|
}
|
|
9555
|
-
void
|
|
9633
|
+
void chunkV32F4I45_js.resolveGoogleWebfontHref(slides, embeddedFonts).then(async (href) => {
|
|
9556
9634
|
if (cancelled || !href) {
|
|
9557
9635
|
return;
|
|
9558
9636
|
}
|
|
@@ -9566,7 +9644,7 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9566
9644
|
if (cancelled) {
|
|
9567
9645
|
return;
|
|
9568
9646
|
}
|
|
9569
|
-
const bytes = await
|
|
9647
|
+
const bytes = await chunkV32F4I45_js.fetchGoogleWebfontOutlineBytes(
|
|
9570
9648
|
href,
|
|
9571
9649
|
family,
|
|
9572
9650
|
variant.bold,
|
|
@@ -9755,7 +9833,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9755
9833
|
inputRef.current = input;
|
|
9756
9834
|
const handleKeyDown = react.useCallback((e) => {
|
|
9757
9835
|
const current = inputRef.current;
|
|
9758
|
-
const startAction =
|
|
9836
|
+
const startAction = chunkV32F4I45_js.mapSlideShowStartKey(e, { isPresenting: current.mode === "present" });
|
|
9759
9837
|
if (startAction !== null) {
|
|
9760
9838
|
e.preventDefault();
|
|
9761
9839
|
if (startAction === "fromBeginning") {
|
|
@@ -9765,7 +9843,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9765
9843
|
}
|
|
9766
9844
|
return;
|
|
9767
9845
|
}
|
|
9768
|
-
const { action, dx, dy } =
|
|
9846
|
+
const { action, dx, dy } = chunkV32F4I45_js.mapEditorKey(e, {
|
|
9769
9847
|
canEdit: current.canEdit,
|
|
9770
9848
|
canPaste: current.canPaste,
|
|
9771
9849
|
// The Slide Master view is an editing surface, not a viewing one.
|
|
@@ -9779,7 +9857,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9779
9857
|
hasSelection: current.hasSelection,
|
|
9780
9858
|
isEditingText: Boolean(current.inlineEditingElementId || current.tableEditorState?.isEditing),
|
|
9781
9859
|
isDrawing: current.activeTool !== "select",
|
|
9782
|
-
isTextInputTarget:
|
|
9860
|
+
isTextInputTarget: chunkV32F4I45_js.isEditorTextInputTarget(e.target)
|
|
9783
9861
|
});
|
|
9784
9862
|
if (action === null) {
|
|
9785
9863
|
return;
|
|
@@ -10113,7 +10191,7 @@ function useViewerIntegration(input) {
|
|
|
10113
10191
|
return zoom.scale;
|
|
10114
10192
|
},
|
|
10115
10193
|
setZoom(level) {
|
|
10116
|
-
zoom.setScale(
|
|
10194
|
+
zoom.setScale(chunkV32F4I45_js.clampZoomScale(level));
|
|
10117
10195
|
},
|
|
10118
10196
|
zoomIn() {
|
|
10119
10197
|
zoom.handleZoomIn();
|
|
@@ -10199,7 +10277,7 @@ function useViewerIntegration(input) {
|
|
|
10199
10277
|
},
|
|
10200
10278
|
// -- Element manipulation --
|
|
10201
10279
|
addElement(element) {
|
|
10202
|
-
const inserted =
|
|
10280
|
+
const inserted = chunkV32F4I45_js.prepareElementForInsertion(element, {
|
|
10203
10281
|
canEdit: canEdit && canInsertElement,
|
|
10204
10282
|
mode,
|
|
10205
10283
|
hasActiveSlide: !loading && !error && Boolean(activeSlide),
|
|
@@ -10355,7 +10433,7 @@ function useReducedMotion() {
|
|
|
10355
10433
|
}
|
|
10356
10434
|
function useViewerOptions() {
|
|
10357
10435
|
const storeRef = react.useRef(null);
|
|
10358
|
-
storeRef.current ??=
|
|
10436
|
+
storeRef.current ??= chunkV32F4I45_js.createViewerOptionsStore();
|
|
10359
10437
|
const store = storeRef.current;
|
|
10360
10438
|
const options = react.useSyncExternalStore(
|
|
10361
10439
|
(onStoreChange) => store.subscribe(onStoreChange),
|
|
@@ -10364,9 +10442,9 @@ function useViewerOptions() {
|
|
|
10364
10442
|
);
|
|
10365
10443
|
return { optionsStore: store, options };
|
|
10366
10444
|
}
|
|
10367
|
-
var KNOWN_TAB_IDS = new Set(
|
|
10445
|
+
var KNOWN_TAB_IDS = new Set(chunkV32F4I45_js.TOOLBAR_TABS.map((tab) => tab.id));
|
|
10368
10446
|
function computeToolbarVisibility(hiddenActions, hiddenTabIds = []) {
|
|
10369
|
-
const isHidden = (id) =>
|
|
10447
|
+
const isHidden = (id) => chunkV32F4I45_js.isActionHidden(id, hiddenActions);
|
|
10370
10448
|
const userHidden = new Set(hiddenTabIds);
|
|
10371
10449
|
userHidden.delete("file");
|
|
10372
10450
|
const isTabVisible = (id) => !KNOWN_TAB_IDS.has(id) || !isHidden(id) && !userHidden.has(id);
|
|
@@ -10459,12 +10537,12 @@ function useYjsDocumentSync({
|
|
|
10459
10537
|
return;
|
|
10460
10538
|
}
|
|
10461
10539
|
try {
|
|
10462
|
-
const handler = new
|
|
10540
|
+
const handler = new chunkV32F4I45_js.PptxHandler();
|
|
10463
10541
|
await handler.load(sourceBytes.buffer);
|
|
10464
|
-
const currentSlides =
|
|
10542
|
+
const currentSlides = chunkV32F4I45_js.readSlidesFromYDoc(
|
|
10465
10543
|
doc
|
|
10466
10544
|
);
|
|
10467
|
-
const slidesToSave =
|
|
10545
|
+
const slidesToSave = chunkV32F4I45_js.buildSaveSlides(currentSlides, templateElementsBySlideId);
|
|
10468
10546
|
const bytes = await handler.save(slidesToSave, getSaveOptions?.());
|
|
10469
10547
|
config.onWriteBack(bytes);
|
|
10470
10548
|
} catch {
|
|
@@ -10479,10 +10557,10 @@ function useYjsDocumentSync({
|
|
|
10479
10557
|
if (!doc || !isConnected) {
|
|
10480
10558
|
return;
|
|
10481
10559
|
}
|
|
10482
|
-
const docSlides =
|
|
10560
|
+
const docSlides = chunkV32F4I45_js.readSlidesFromYDoc(
|
|
10483
10561
|
doc
|
|
10484
10562
|
);
|
|
10485
|
-
if (!
|
|
10563
|
+
if (!chunkV32F4I45_js.shouldRoomSlidesReplaceLoad(loadOrigin, docSlides.length)) {
|
|
10486
10564
|
return;
|
|
10487
10565
|
}
|
|
10488
10566
|
lastSyncedRef.current = JSON.stringify(docSlides);
|
|
@@ -10501,11 +10579,11 @@ function useYjsDocumentSync({
|
|
|
10501
10579
|
lastSyncedRef.current = serialized;
|
|
10502
10580
|
void (async () => {
|
|
10503
10581
|
const factories = await getFactories();
|
|
10504
|
-
|
|
10582
|
+
chunkV32F4I45_js.reconcileSlidesInYDoc(
|
|
10505
10583
|
slides,
|
|
10506
10584
|
doc,
|
|
10507
10585
|
factories,
|
|
10508
|
-
|
|
10586
|
+
chunkV32F4I45_js.LOCAL_SYNC_ORIGIN
|
|
10509
10587
|
);
|
|
10510
10588
|
scheduleWriteBack();
|
|
10511
10589
|
})();
|
|
@@ -10519,10 +10597,10 @@ function useYjsDocumentSync({
|
|
|
10519
10597
|
return;
|
|
10520
10598
|
}
|
|
10521
10599
|
const handleChange = (_events, transaction) => {
|
|
10522
|
-
if (transaction?.origin ===
|
|
10600
|
+
if (transaction?.origin === chunkV32F4I45_js.LOCAL_SYNC_ORIGIN) {
|
|
10523
10601
|
return;
|
|
10524
10602
|
}
|
|
10525
|
-
const remoteSlides =
|
|
10603
|
+
const remoteSlides = chunkV32F4I45_js.readSlidesFromYDoc(
|
|
10526
10604
|
doc
|
|
10527
10605
|
);
|
|
10528
10606
|
if (remoteSlides.length === 0) {
|
|
@@ -10538,7 +10616,7 @@ function useYjsDocumentSync({
|
|
|
10538
10616
|
isApplyingRemoteRef.current = false;
|
|
10539
10617
|
scheduleWriteBack();
|
|
10540
10618
|
};
|
|
10541
|
-
const unobserve =
|
|
10619
|
+
const unobserve = chunkV32F4I45_js.observeYDocSlides(
|
|
10542
10620
|
doc,
|
|
10543
10621
|
handleChange
|
|
10544
10622
|
);
|
|
@@ -10576,7 +10654,7 @@ function useBroadcastFollower({
|
|
|
10576
10654
|
if (!broadcaster) {
|
|
10577
10655
|
return;
|
|
10578
10656
|
}
|
|
10579
|
-
if (!
|
|
10657
|
+
if (!chunkV32F4I45_js.shouldAutoFollowBroadcaster({
|
|
10580
10658
|
localRole: collab.config.role,
|
|
10581
10659
|
broadcasterRole: broadcaster.role
|
|
10582
10660
|
})) {
|
|
@@ -10734,7 +10812,7 @@ function useLayoutSwitching(input) {
|
|
|
10734
10812
|
currentLayoutPath
|
|
10735
10813
|
};
|
|
10736
10814
|
}
|
|
10737
|
-
var MIN_TOUCH_TARGET =
|
|
10815
|
+
var MIN_TOUCH_TARGET = chunkV32F4I45_js.MIN_TOUCH_TARGET_PX;
|
|
10738
10816
|
function subscribeTouchCapability(callback) {
|
|
10739
10817
|
if (typeof window === "undefined") {
|
|
10740
10818
|
return () => {
|
|
@@ -10747,7 +10825,7 @@ function subscribeTouchCapability(callback) {
|
|
|
10747
10825
|
function useIsMobile() {
|
|
10748
10826
|
const isTouchDevice = react.useSyncExternalStore(
|
|
10749
10827
|
subscribeTouchCapability,
|
|
10750
|
-
|
|
10828
|
+
chunkV32F4I45_js.detectTouchDevice,
|
|
10751
10829
|
() => false
|
|
10752
10830
|
// server snapshot
|
|
10753
10831
|
);
|
|
@@ -10757,7 +10835,7 @@ function useIsMobile() {
|
|
|
10757
10835
|
const [viewportHeight, setViewportHeight] = react.useState(
|
|
10758
10836
|
() => typeof window === "undefined" ? 768 : window.innerHeight
|
|
10759
10837
|
);
|
|
10760
|
-
const [orientation, setOrientation] = react.useState(
|
|
10838
|
+
const [orientation, setOrientation] = react.useState(chunkV32F4I45_js.detectOrientation);
|
|
10761
10839
|
const [isVirtualKeyboardOpen, setIsVirtualKeyboardOpen] = react.useState(false);
|
|
10762
10840
|
const [initialViewportHeight] = react.useState(
|
|
10763
10841
|
() => typeof window !== "undefined" ? window.innerHeight : 800
|
|
@@ -10778,7 +10856,7 @@ function useIsMobile() {
|
|
|
10778
10856
|
return;
|
|
10779
10857
|
}
|
|
10780
10858
|
const handleOrientationChange = () => {
|
|
10781
|
-
setOrientation(
|
|
10859
|
+
setOrientation(chunkV32F4I45_js.detectOrientation());
|
|
10782
10860
|
};
|
|
10783
10861
|
if (screen.orientation) {
|
|
10784
10862
|
screen.orientation.addEventListener("change", handleOrientationChange);
|
|
@@ -10808,7 +10886,7 @@ function useIsMobile() {
|
|
|
10808
10886
|
window.addEventListener("resize", handleResize);
|
|
10809
10887
|
return () => window.removeEventListener("resize", handleResize);
|
|
10810
10888
|
}, [isTouchDevice, initialViewportHeight]);
|
|
10811
|
-
const { isMobile, isTablet, isDesktop } =
|
|
10889
|
+
const { isMobile, isTablet, isDesktop } = chunkV32F4I45_js.deriveViewportBreakpoints(
|
|
10812
10890
|
viewportWidth,
|
|
10813
10891
|
viewportHeight,
|
|
10814
10892
|
isTouchDevice
|
|
@@ -10841,10 +10919,10 @@ function useTouchGestures(input) {
|
|
|
10841
10919
|
if (!el || !enabled) {
|
|
10842
10920
|
return;
|
|
10843
10921
|
}
|
|
10844
|
-
const recognizer =
|
|
10922
|
+
const recognizer = chunkV32F4I45_js.createTouchGestureRecognizer({
|
|
10845
10923
|
getScale: () => scaleRef.current,
|
|
10846
|
-
minScale:
|
|
10847
|
-
maxScale:
|
|
10924
|
+
minScale: chunkV32F4I45_js.MIN_ZOOM_SCALE,
|
|
10925
|
+
maxScale: chunkV32F4I45_js.MAX_ZOOM_SCALE,
|
|
10848
10926
|
callbacks: {
|
|
10849
10927
|
onPinchZoom: (newScale) => callbacksRef.current.onPinchZoom?.(newScale),
|
|
10850
10928
|
onSwipe: (direction) => callbacksRef.current.onSwipe?.(direction),
|
|
@@ -10884,7 +10962,7 @@ function scrollFocusedIntoView(keyboardInset) {
|
|
|
10884
10962
|
return;
|
|
10885
10963
|
}
|
|
10886
10964
|
const rect = active.getBoundingClientRect();
|
|
10887
|
-
const delta =
|
|
10965
|
+
const delta = chunkV32F4I45_js.computeScrollDelta(
|
|
10888
10966
|
{ top: rect.top, bottom: rect.bottom },
|
|
10889
10967
|
window.innerHeight,
|
|
10890
10968
|
keyboardInset
|
|
@@ -10904,8 +10982,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10904
10982
|
return;
|
|
10905
10983
|
}
|
|
10906
10984
|
const update = () => {
|
|
10907
|
-
const metrics =
|
|
10908
|
-
const inset = metrics ?
|
|
10985
|
+
const metrics = chunkV32F4I45_js.readViewportMetrics(window);
|
|
10986
|
+
const inset = metrics ? chunkV32F4I45_js.computeKeyboardInset(metrics) : 0;
|
|
10909
10987
|
setKeyboardInset(inset);
|
|
10910
10988
|
if (inset > 0) {
|
|
10911
10989
|
window.requestAnimationFrame(() => scrollFocusedIntoView(inset));
|
|
@@ -10916,8 +10994,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10916
10994
|
vv.addEventListener("scroll", update);
|
|
10917
10995
|
const onFocusIn = () => {
|
|
10918
10996
|
window.requestAnimationFrame(() => {
|
|
10919
|
-
const metrics =
|
|
10920
|
-
const inset = metrics ?
|
|
10997
|
+
const metrics = chunkV32F4I45_js.readViewportMetrics(window);
|
|
10998
|
+
const inset = metrics ? chunkV32F4I45_js.computeKeyboardInset(metrics) : 0;
|
|
10921
10999
|
if (inset > 0) {
|
|
10922
11000
|
scrollFocusedIntoView(inset);
|
|
10923
11001
|
}
|
|
@@ -10930,7 +11008,7 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10930
11008
|
document.removeEventListener("focusin", onFocusIn);
|
|
10931
11009
|
};
|
|
10932
11010
|
}, [enabled]);
|
|
10933
|
-
return { keyboardInset, isKeyboardOpen:
|
|
11011
|
+
return { keyboardInset, isKeyboardOpen: chunkV32F4I45_js.isKeyboardOpen(keyboardInset) };
|
|
10934
11012
|
}
|
|
10935
11013
|
|
|
10936
11014
|
// src/viewer/hooks/useViewerBuildingBlocks-canvas-props.ts
|
|
@@ -10959,21 +11037,21 @@ function buildCanvasProps(input) {
|
|
|
10959
11037
|
} = input;
|
|
10960
11038
|
const effectiveSlide = mode === "master" ? masterPseudoSlide : activeSlide;
|
|
10961
11039
|
const effectiveTemplateElements = mode === "master" ? s.activeLayout ? s.activeMaster?.elements ?? [] : [] : templateElements;
|
|
10962
|
-
const fieldContext =
|
|
11040
|
+
const fieldContext = chunkV32F4I45_js.buildFieldSubstitutionContext({
|
|
10963
11041
|
headerFooter: s.headerFooter,
|
|
10964
11042
|
customProperties: s.customProperties,
|
|
10965
11043
|
slide: activeSlide
|
|
10966
11044
|
});
|
|
10967
11045
|
const tableStyleContext = s.theme || s.tableStyleMap ? { theme: s.theme, tableStyleMap: s.tableStyleMap } : void 0;
|
|
10968
11046
|
const openExternalUrl = (url, target) => {
|
|
10969
|
-
if (
|
|
11047
|
+
if (chunkV32F4I45_js.shouldConfirmExternalHyperlink(viewerOptions, url) && !window.confirm(buildHyperlinkConfirmMessage(url))) {
|
|
10970
11048
|
return;
|
|
10971
11049
|
}
|
|
10972
|
-
|
|
11050
|
+
chunkV32F4I45_js.safeOpenUrl(url, target);
|
|
10973
11051
|
};
|
|
10974
11052
|
const handleActionClick = (elementId, action) => {
|
|
10975
11053
|
if (mode === "present") {
|
|
10976
|
-
const resolved =
|
|
11054
|
+
const resolved = chunkV32F4I45_js.resolvePresentationAction(action, { slideCount: slides.length });
|
|
10977
11055
|
if (resolved.intent.kind === "openUrl") {
|
|
10978
11056
|
openExternalUrl(resolved.intent.url);
|
|
10979
11057
|
return;
|
|
@@ -10984,9 +11062,9 @@ function buildCanvasProps(input) {
|
|
|
10984
11062
|
}
|
|
10985
11063
|
};
|
|
10986
11064
|
const handleHyperlinkClick = (url, target) => {
|
|
10987
|
-
if (
|
|
11065
|
+
if (chunkV32F4I45_js.isPpactionUrl(url)) {
|
|
10988
11066
|
if (mode === "present") {
|
|
10989
|
-
const parsed =
|
|
11067
|
+
const parsed = chunkV32F4I45_js.parsePpactionUrl(url);
|
|
10990
11068
|
if (parsed) {
|
|
10991
11069
|
presentation.handlePresentationAction({
|
|
10992
11070
|
action: parsed.action,
|
|
@@ -11092,7 +11170,7 @@ function buildCanvasProps(input) {
|
|
|
11092
11170
|
|
|
11093
11171
|
// src/viewer/hooks/useScopedLayoutOptions.ts
|
|
11094
11172
|
function scopeLayoutOptionsToActiveSlide(options, activeSlide) {
|
|
11095
|
-
return
|
|
11173
|
+
return chunkV32F4I45_js.scopeLayoutOptionsToSlide(options, activeSlide?.layoutPath);
|
|
11096
11174
|
}
|
|
11097
11175
|
|
|
11098
11176
|
// src/viewer/hooks/useViewerBuildingBlocks-toolbar-handlers.ts
|
|
@@ -11105,7 +11183,7 @@ function buildToolbarAnimationHandlers(input) {
|
|
|
11105
11183
|
const current = activeSlide.animations ?? [];
|
|
11106
11184
|
if (group === "motionPath") {
|
|
11107
11185
|
propertyHandlers.handleUpdateSlide({
|
|
11108
|
-
animations:
|
|
11186
|
+
animations: chunkV32F4I45_js.applyMotionPathPreset(current, selectedElement.id, preset)
|
|
11109
11187
|
});
|
|
11110
11188
|
return;
|
|
11111
11189
|
}
|
|
@@ -11301,7 +11379,7 @@ function buildToolbarProps(input) {
|
|
|
11301
11379
|
onOpenFile,
|
|
11302
11380
|
onOpenRecentFile,
|
|
11303
11381
|
onCreatePresentation: (templateId) => {
|
|
11304
|
-
s.setSlides(
|
|
11382
|
+
s.setSlides(chunkV32F4I45_js.createBackstagePresentation(templateId));
|
|
11305
11383
|
s.setActiveSlideIndex(0);
|
|
11306
11384
|
s.setSelectedElementId(null);
|
|
11307
11385
|
s.setSelectedElementIds([]);
|
|
@@ -11323,6 +11401,7 @@ function buildToolbarProps(input) {
|
|
|
11323
11401
|
onOpenReadingView: () => s.setShowReadingView(true),
|
|
11324
11402
|
onOpenOutlineView: () => s.setShowOutlineView(true),
|
|
11325
11403
|
onUpdateTextStyle: ops.updateSelectedTextStyle,
|
|
11404
|
+
onToggleBullets: ops.toggleSelectedBullets,
|
|
11326
11405
|
onTransformTextCase: ops.updateSelectedTextCase,
|
|
11327
11406
|
isOverflowMenuOpen: s.isOverflowMenuOpen,
|
|
11328
11407
|
onSetOverflowMenuOpen: s.setIsOverflowMenuOpen,
|
|
@@ -11331,7 +11410,7 @@ function buildToolbarProps(input) {
|
|
|
11331
11410
|
loadLayoutPreviews: input.loadLayoutPreviews,
|
|
11332
11411
|
onInsertSlideFromLayout: slideOps.handleInsertSlideFromLayout,
|
|
11333
11412
|
onInsertSlideFromTemplate: slideOps.handleInsertSlideFromTemplate,
|
|
11334
|
-
templateScheme:
|
|
11413
|
+
templateScheme: chunkV32F4I45_js.templateSchemeFromTheme(s.theme?.colorScheme),
|
|
11335
11414
|
customShows: s.customShows,
|
|
11336
11415
|
activeCustomShowId: s.activeCustomShowId,
|
|
11337
11416
|
onSetActiveCustomShowId: s.setActiveCustomShowId,
|
|
@@ -11372,7 +11451,7 @@ function buildToolbarProps(input) {
|
|
|
11372
11451
|
isCommentsPanelOpen: s.isInspectorPaneOpen,
|
|
11373
11452
|
slideCommentCount: activeSlide?.comments?.length ?? 0,
|
|
11374
11453
|
formatPainterActive: s.formatPainterActive,
|
|
11375
|
-
canActivateFormatPainter:
|
|
11454
|
+
canActivateFormatPainter: chunkV32F4I45_js.hasCopyableFormat(selectedElement),
|
|
11376
11455
|
onToggleFormatPainter: () => s.setFormatPainterActive((p) => !p),
|
|
11377
11456
|
isSelectionPaneOpen: s.isSelectionPaneOpen,
|
|
11378
11457
|
onToggleSelectionPane: () => s.setIsSelectionPaneOpen((p) => !p),
|
|
@@ -11455,7 +11534,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11455
11534
|
headerFooter: state.headerFooter,
|
|
11456
11535
|
loading,
|
|
11457
11536
|
error,
|
|
11458
|
-
maxHistoryEntries:
|
|
11537
|
+
maxHistoryEntries: chunkV32F4I45_js.resolveHistoryDepth(viewerOptions),
|
|
11459
11538
|
hasActivePointerInteraction,
|
|
11460
11539
|
pointerCommitNonce: state.pointerCommitNonce,
|
|
11461
11540
|
onDirty: markDocumentDirty,
|
|
@@ -11480,7 +11559,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11480
11559
|
documentGridSpacing: state.viewProperties?.gridSpacing
|
|
11481
11560
|
});
|
|
11482
11561
|
const themeColorMap = react.useMemo(
|
|
11483
|
-
() => state.theme?.colorScheme ?
|
|
11562
|
+
() => state.theme?.colorScheme ? chunkV32F4I45_js.buildThemeColorMap(state.theme.colorScheme) : void 0,
|
|
11484
11563
|
[state.theme?.colorScheme]
|
|
11485
11564
|
);
|
|
11486
11565
|
const { presentation, annotations, actionSoundHandlerRef, setExitModeHandler } = usePresentationSetup({
|
|
@@ -11529,8 +11608,8 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11529
11608
|
gridSpacingPx,
|
|
11530
11609
|
// Multiplied against the pre-existing 2x baseline; see the matching
|
|
11531
11610
|
// comment in `PowerPointViewer.tsx`.
|
|
11532
|
-
imageExportScale: 2 *
|
|
11533
|
-
imageResolutionScale:
|
|
11611
|
+
imageExportScale: 2 * chunkV32F4I45_js.resolveImageResolutionScale(viewerOptions),
|
|
11612
|
+
imageResolutionScale: chunkV32F4I45_js.resolveImageResolutionScale(viewerOptions),
|
|
11534
11613
|
viewerOptions
|
|
11535
11614
|
};
|
|
11536
11615
|
}
|
|
@@ -11546,7 +11625,7 @@ function useCompatibilityToastsState() {
|
|
|
11546
11625
|
}
|
|
11547
11626
|
function useReadOnlyRecommendationState(content) {
|
|
11548
11627
|
const [recommendation, setRecommendation] = react.useState(
|
|
11549
|
-
() =>
|
|
11628
|
+
() => chunkV32F4I45_js.readOnlyRecommendation(void 0)
|
|
11550
11629
|
);
|
|
11551
11630
|
const [modifyVerifier, setModifyVerifier] = react.useState(void 0);
|
|
11552
11631
|
const [bannerHidden, setBannerHidden] = react.useState(false);
|
|
@@ -11586,7 +11665,7 @@ function useReadOnlyRecommendationState(content) {
|
|
|
11586
11665
|
async (password) => {
|
|
11587
11666
|
setCheckingPassword(true);
|
|
11588
11667
|
try {
|
|
11589
|
-
const result = await
|
|
11668
|
+
const result = await chunkV32F4I45_js.checkModifyPassword(modifyVerifier, password);
|
|
11590
11669
|
if (result.ok) {
|
|
11591
11670
|
unlock();
|
|
11592
11671
|
} else {
|
|
@@ -11631,9 +11710,9 @@ function useViewPreferencesSync(input) {
|
|
|
11631
11710
|
setShowGuides
|
|
11632
11711
|
} = input;
|
|
11633
11712
|
react.useEffect(() => {
|
|
11634
|
-
const seeded =
|
|
11713
|
+
const seeded = chunkV32F4I45_js.viewerPreferencesFromViewProperties(
|
|
11635
11714
|
{ viewProperties },
|
|
11636
|
-
{ ...
|
|
11715
|
+
{ ...chunkV32F4I45_js.DEFAULT_VIEWER_PREFERENCES, snapToGrid, snapToObjects: snapToShape, showGuides }
|
|
11637
11716
|
);
|
|
11638
11717
|
setSnapToGrid(seeded.snapToGrid);
|
|
11639
11718
|
setSnapToShape(seeded.snapToObjects ?? snapToShape);
|
|
@@ -11643,7 +11722,7 @@ function useViewPreferencesSync(input) {
|
|
|
11643
11722
|
(prefsOverride) => {
|
|
11644
11723
|
setViewProperties((prev) => {
|
|
11645
11724
|
const merged = {
|
|
11646
|
-
...
|
|
11725
|
+
...chunkV32F4I45_js.DEFAULT_VIEWER_PREFERENCES,
|
|
11647
11726
|
snapToGrid,
|
|
11648
11727
|
snapToObjects: snapToShape,
|
|
11649
11728
|
showGuides,
|
|
@@ -11651,7 +11730,7 @@ function useViewPreferencesSync(input) {
|
|
|
11651
11730
|
gridSpacingCy: prev?.gridSpacing?.cy,
|
|
11652
11731
|
...prefsOverride
|
|
11653
11732
|
};
|
|
11654
|
-
const patch =
|
|
11733
|
+
const patch = chunkV32F4I45_js.viewPropertiesPatchFromPreferences(merged);
|
|
11655
11734
|
return {
|
|
11656
11735
|
...prev,
|
|
11657
11736
|
slideViewPr: { ...prev?.slideViewPr, ...patch.slideViewPr },
|
|
@@ -11874,7 +11953,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
11874
11953
|
}, [incomingContent]);
|
|
11875
11954
|
const onOpenFile = react.useCallback(() => {
|
|
11876
11955
|
void (async () => {
|
|
11877
|
-
const picked = await
|
|
11956
|
+
const picked = await chunkV32F4I45_js.openPptxFile();
|
|
11878
11957
|
if (picked) {
|
|
11879
11958
|
setContent(picked.buffer);
|
|
11880
11959
|
}
|
|
@@ -11882,7 +11961,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
11882
11961
|
}, []);
|
|
11883
11962
|
const onOpenRecentFile = react.useCallback((key) => {
|
|
11884
11963
|
void (async () => {
|
|
11885
|
-
const bytes = await
|
|
11964
|
+
const bytes = await chunkV32F4I45_js.readBackstageRecentFile(key);
|
|
11886
11965
|
if (bytes) {
|
|
11887
11966
|
setContent(bytes);
|
|
11888
11967
|
}
|