pptx-react-viewer 4.55.0 → 4.56.1
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 +60 -0
- package/README.md +16 -1
- package/dist/ai.d.ts +17 -0
- package/dist/ai.js +11 -0
- package/dist/ai.js.br +2 -0
- package/dist/ai.js.gz +0 -0
- package/dist/ai.mjs +9 -0
- package/dist/ai.mjs.br +0 -0
- package/dist/ai.mjs.gz +0 -0
- package/dist/{chunk-EXSGJHOH.mjs → chunk-3CN33VMC.mjs} +3017 -3037
- package/dist/chunk-3CN33VMC.mjs.br +0 -0
- package/dist/chunk-3CN33VMC.mjs.gz +0 -0
- package/dist/chunk-F6WCYCHV.js +40 -0
- package/dist/chunk-F6WCYCHV.js.br +0 -0
- package/dist/chunk-F6WCYCHV.js.gz +0 -0
- package/dist/chunk-NE5JQMED.mjs +37 -0
- package/dist/chunk-NE5JQMED.mjs.br +0 -0
- package/dist/chunk-NE5JQMED.mjs.gz +0 -0
- package/dist/{chunk-OIQAJR57.js → chunk-OOBBI4DH.js} +106 -8
- package/dist/chunk-OOBBI4DH.js.br +0 -0
- package/dist/chunk-OOBBI4DH.js.gz +0 -0
- package/dist/{chunk-V7JICDSL.js → chunk-PAJZXF2Q.js} +3113 -3132
- package/dist/chunk-PAJZXF2Q.js.br +0 -0
- package/dist/chunk-PAJZXF2Q.js.gz +0 -0
- package/dist/{chunk-64BFLDBT.mjs → chunk-UMGVFMAW.mjs} +107 -9
- package/dist/chunk-UMGVFMAW.mjs.br +0 -0
- package/dist/chunk-UMGVFMAW.mjs.gz +0 -0
- package/dist/index.d.ts +95 -14
- package/dist/index.js +28 -23
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +64 -7
- package/dist/internals.js +80 -80
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +1 -1
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/pptx-viewer-canvas.css +1 -1
- package/dist/pptx-viewer-canvas.css.br +0 -0
- package/dist/pptx-viewer-canvas.css.gz +0 -0
- package/dist/viewer/index.d.ts +20 -10
- package/dist/viewer/index.js +19 -18
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +3 -2
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +9 -4
- package/dist/chunk-64BFLDBT.mjs.br +0 -0
- package/dist/chunk-64BFLDBT.mjs.gz +0 -0
- package/dist/chunk-EXSGJHOH.mjs.br +0 -0
- package/dist/chunk-EXSGJHOH.mjs.gz +0 -0
- package/dist/chunk-OIQAJR57.js.br +0 -0
- package/dist/chunk-OIQAJR57.js.gz +0 -0
- package/dist/chunk-V7JICDSL.js.br +0 -0
- package/dist/chunk-V7JICDSL.js.gz +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var host = require('ooxml-ui/pptx/ai/host');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var lu = require('react-icons/lu');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
// src/viewer/ai-assistant-registry.ts
|
|
9
|
+
var aiAssistants = host.createAiAssistantRegistry({
|
|
10
|
+
owner: "pptx-react-viewer"
|
|
11
|
+
});
|
|
12
|
+
var AiChatPanel = /* @__PURE__ */ react.lazy(async () => {
|
|
13
|
+
const [{ useChat }, { default: Panel }] = await Promise.all([
|
|
14
|
+
import('@ai-sdk/react'),
|
|
15
|
+
import('./AiChatPanel-7DESUEAZ.js')
|
|
16
|
+
]);
|
|
17
|
+
function BoundAiChatPanel(props) {
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...props, useChat });
|
|
19
|
+
}
|
|
20
|
+
return { default: BoundAiChatPanel };
|
|
21
|
+
});
|
|
22
|
+
function AiChatPanelLazy(props) {
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
+
react.Suspense,
|
|
25
|
+
{
|
|
26
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: "absolute right-0 top-0 z-30 flex h-full w-80 items-center justify-center border-l border-border bg-card text-muted-foreground max-md:inset-x-0 max-md:top-auto max-md:bottom-0 max-md:h-[75dvh] max-md:w-full max-md:rounded-t-2xl max-md:border-l-0 max-md:border-t max-md:shadow-2xl",
|
|
30
|
+
style: props.panelWidth ? { width: props.panelWidth } : void 0,
|
|
31
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuLoaderCircle, { className: "w-5 h-5 animate-spin" })
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(AiChatPanel, { ...props })
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.AiChatPanelLazy = AiChatPanelLazy;
|
|
40
|
+
exports.aiAssistants = aiAssistants;
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createAiAssistantRegistry } from 'ooxml-ui/pptx/ai/host';
|
|
2
|
+
import { Suspense, lazy } from 'react';
|
|
3
|
+
import { LuLoaderCircle } from 'react-icons/lu';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/viewer/ai-assistant-registry.ts
|
|
7
|
+
var aiAssistants = createAiAssistantRegistry({
|
|
8
|
+
owner: "pptx-react-viewer"
|
|
9
|
+
});
|
|
10
|
+
var AiChatPanel = /* @__PURE__ */ lazy(async () => {
|
|
11
|
+
const [{ useChat }, { default: Panel }] = await Promise.all([
|
|
12
|
+
import('@ai-sdk/react'),
|
|
13
|
+
import('./AiChatPanel-GQ64SIYP.mjs')
|
|
14
|
+
]);
|
|
15
|
+
function BoundAiChatPanel(props) {
|
|
16
|
+
return /* @__PURE__ */ jsx(Panel, { ...props, useChat });
|
|
17
|
+
}
|
|
18
|
+
return { default: BoundAiChatPanel };
|
|
19
|
+
});
|
|
20
|
+
function AiChatPanelLazy(props) {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
Suspense,
|
|
23
|
+
{
|
|
24
|
+
fallback: /* @__PURE__ */ jsx(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: "absolute right-0 top-0 z-30 flex h-full w-80 items-center justify-center border-l border-border bg-card text-muted-foreground max-md:inset-x-0 max-md:top-auto max-md:bottom-0 max-md:h-[75dvh] max-md:w-full max-md:rounded-t-2xl max-md:border-l-0 max-md:border-t max-md:shadow-2xl",
|
|
28
|
+
style: props.panelWidth ? { width: props.panelWidth } : void 0,
|
|
29
|
+
children: /* @__PURE__ */ jsx(LuLoaderCircle, { className: "w-5 h-5 animate-spin" })
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
children: /* @__PURE__ */ jsx(AiChatPanel, { ...props })
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { AiChatPanelLazy, aiAssistants };
|
|
Binary file
|
|
Binary file
|
|
@@ -98,6 +98,7 @@ function useYjsProvider({ config: inputConfig }) {
|
|
|
98
98
|
);
|
|
99
99
|
const state = useController(controller);
|
|
100
100
|
const signalingKey = config?.signaling?.join("\n");
|
|
101
|
+
const enabled = Boolean(config);
|
|
101
102
|
React17.useEffect(() => {
|
|
102
103
|
if (!config) {
|
|
103
104
|
controller.stop();
|
|
@@ -119,7 +120,7 @@ function useYjsProvider({ config: inputConfig }) {
|
|
|
119
120
|
config?.authToken,
|
|
120
121
|
config?.transport,
|
|
121
122
|
signalingKey,
|
|
122
|
-
|
|
123
|
+
enabled
|
|
123
124
|
]);
|
|
124
125
|
const session = state.active ? controller.getSession() : null;
|
|
125
126
|
return {
|
|
@@ -917,6 +918,7 @@ function useEditorHistory(input) {
|
|
|
917
918
|
handleRedo,
|
|
918
919
|
resetHistory,
|
|
919
920
|
forgetHistory: history.forget,
|
|
921
|
+
attachCollaboration: history.attachCollaboration,
|
|
920
922
|
markDirty,
|
|
921
923
|
withoutUndoStep,
|
|
922
924
|
buildHistorySnapshot
|
|
@@ -5649,7 +5651,7 @@ function useCanvasInteractions(input) {
|
|
|
5649
5651
|
return;
|
|
5650
5652
|
}
|
|
5651
5653
|
const liveText = read?.snapshot.text ?? inlineEditingTextRef?.current ?? inlineEditingText;
|
|
5652
|
-
const committedText = transformCommittedText ? transformCommittedText(liveText) : liveText;
|
|
5654
|
+
const committedText = transformCommittedText ? transformCommittedText(liveText, el.text) : liveText;
|
|
5653
5655
|
const textPatch = pptx.buildInlineTextCommitPatch(
|
|
5654
5656
|
el,
|
|
5655
5657
|
committedText,
|
|
@@ -7121,7 +7123,7 @@ function createTableStructHandlers(input) {
|
|
|
7121
7123
|
if (!el || el.type !== "table") {
|
|
7122
7124
|
return;
|
|
7123
7125
|
}
|
|
7124
|
-
const text = transformCommittedText ? transformCommittedText(rawText) : rawText;
|
|
7126
|
+
const text = transformCommittedText ? transformCommittedText(rawText, pptx.getCellText(el, rowIndex, colIndex)) : rawText;
|
|
7125
7127
|
const updates = {};
|
|
7126
7128
|
if (el.tableData) {
|
|
7127
7129
|
updates.tableData = pptx.setCellText(el, rowIndex, colIndex, text).tableData;
|
|
@@ -9235,10 +9237,11 @@ function useSerialize(input) {
|
|
|
9235
9237
|
}
|
|
9236
9238
|
const pendingEditText = read?.snapshot.text ?? inlineEditingTextRef.current;
|
|
9237
9239
|
const pendingSnapshot = read?.snapshot ?? inlineEditingSnapshotRef?.current;
|
|
9240
|
+
const heldDeck = heldDeckRef?.current;
|
|
9238
9241
|
const pending = overlayPendingInlineEdit(
|
|
9239
9242
|
{
|
|
9240
|
-
slides:
|
|
9241
|
-
templateElementsBySlideId:
|
|
9243
|
+
slides: heldDeck?.slides ?? slides,
|
|
9244
|
+
templateElementsBySlideId: heldDeck?.templateElementsBySlideId ?? templateElementsBySlideId,
|
|
9242
9245
|
activeSlideIndex,
|
|
9243
9246
|
editTemplateMode,
|
|
9244
9247
|
masterViewTarget,
|
|
@@ -9316,6 +9319,7 @@ function useSerialize(input) {
|
|
|
9316
9319
|
editTemplateMode,
|
|
9317
9320
|
masterViewTarget,
|
|
9318
9321
|
handlerRef,
|
|
9322
|
+
heldDeckRef,
|
|
9319
9323
|
inlineEditingElementIdRef,
|
|
9320
9324
|
inlineEditingTextRef,
|
|
9321
9325
|
inlineEditingSnapshotRef,
|
|
@@ -11993,6 +11997,70 @@ function buildCanvasProps(input) {
|
|
|
11993
11997
|
}
|
|
11994
11998
|
};
|
|
11995
11999
|
}
|
|
12000
|
+
function useSlidesPaneProps({
|
|
12001
|
+
state,
|
|
12002
|
+
slides,
|
|
12003
|
+
canEdit,
|
|
12004
|
+
activeSlideIndex,
|
|
12005
|
+
slideSectionGroups,
|
|
12006
|
+
slideOps,
|
|
12007
|
+
sectionOps,
|
|
12008
|
+
recordedTimings,
|
|
12009
|
+
onOpenLayoutGallery
|
|
12010
|
+
}) {
|
|
12011
|
+
const { setActiveSlideIndex, setIsSlidesPaneOpen } = state;
|
|
12012
|
+
const fieldContext = React17.useMemo(
|
|
12013
|
+
() => pptx.buildSlidesPaneFieldContext({
|
|
12014
|
+
headerFooter: state.headerFooter,
|
|
12015
|
+
customProperties: state.customProperties,
|
|
12016
|
+
firstSlideNumber: state.firstSlideNumber
|
|
12017
|
+
}),
|
|
12018
|
+
[state.headerFooter, state.customProperties, state.firstSlideNumber]
|
|
12019
|
+
);
|
|
12020
|
+
const tableStyleContext = React17.useMemo(
|
|
12021
|
+
() => pptx.buildSlidesPaneTableStyleContext(state.theme, state.tableStyleMap),
|
|
12022
|
+
[state.theme, state.tableStyleMap]
|
|
12023
|
+
);
|
|
12024
|
+
const rehearsalTimings = React17.useMemo(
|
|
12025
|
+
() => pptx.slidesPaneRehearsalTimings(recordedTimings),
|
|
12026
|
+
[recordedTimings]
|
|
12027
|
+
);
|
|
12028
|
+
const onOpenLayoutForSlide = React17.useCallback(
|
|
12029
|
+
(slideIndex, x, y) => {
|
|
12030
|
+
pptx.openSlidesPaneLayoutGallery({ slideIndex, x, y }, setActiveSlideIndex, onOpenLayoutGallery);
|
|
12031
|
+
},
|
|
12032
|
+
[setActiveSlideIndex, onOpenLayoutGallery]
|
|
12033
|
+
);
|
|
12034
|
+
const onCollapse = React17.useCallback(() => setIsSlidesPaneOpen(false), [setIsSlidesPaneOpen]);
|
|
12035
|
+
return {
|
|
12036
|
+
slides,
|
|
12037
|
+
templateElementsBySlideId: state.templateElementsBySlideId,
|
|
12038
|
+
activeSlideIndex,
|
|
12039
|
+
canvasSize: state.canvasSize,
|
|
12040
|
+
sectionGroups: slideSectionGroups,
|
|
12041
|
+
isOpen: state.isSlidesPaneOpen,
|
|
12042
|
+
canEdit,
|
|
12043
|
+
onSelectSlide: setActiveSlideIndex,
|
|
12044
|
+
onSlideContextMenu: slideOps.handleSlideContextMenu,
|
|
12045
|
+
onMoveSlide: slideOps.handleMoveSlide,
|
|
12046
|
+
onAddSlide: slideOps.handleAddSlide,
|
|
12047
|
+
onAddSlideAfter: slideOps.handleAddSlideAfter,
|
|
12048
|
+
onDuplicateSlides: slideOps.handleDuplicateSlides,
|
|
12049
|
+
onDeleteSlides: slideOps.handleDeleteSlides,
|
|
12050
|
+
onHideSlides: slideOps.handleToggleHideSlides,
|
|
12051
|
+
onOpenLayoutForSlide,
|
|
12052
|
+
onCollapse,
|
|
12053
|
+
onAddSection: sectionOps.addSection,
|
|
12054
|
+
onRenameSection: sectionOps.renameSection,
|
|
12055
|
+
onDeleteSection: sectionOps.deleteSection,
|
|
12056
|
+
onMoveSectionUp: sectionOps.moveSectionUp,
|
|
12057
|
+
onMoveSectionDown: sectionOps.moveSectionDown,
|
|
12058
|
+
onToggleSectionCollapse: sectionOps.toggleSectionCollapse,
|
|
12059
|
+
rehearsalTimings,
|
|
12060
|
+
fieldContext,
|
|
12061
|
+
tableStyleContext
|
|
12062
|
+
};
|
|
12063
|
+
}
|
|
11996
12064
|
|
|
11997
12065
|
// src/viewer/hooks/createReviewCommentsHost.ts
|
|
11998
12066
|
function createReviewCommentsHost(input) {
|
|
@@ -12467,7 +12535,7 @@ function RemoteSelectionOverlay({
|
|
|
12467
12535
|
)) });
|
|
12468
12536
|
}
|
|
12469
12537
|
function useCollaborationDocumentSync(input) {
|
|
12470
|
-
const { collaboration, ...state } = input;
|
|
12538
|
+
const { collaboration, history, ...state } = input;
|
|
12471
12539
|
const latest = React17.useRef(input);
|
|
12472
12540
|
latest.current = input;
|
|
12473
12541
|
const getSourceBytes = React17.useCallback(() => {
|
|
@@ -12486,6 +12554,20 @@ function useCollaborationDocumentSync(input) {
|
|
|
12486
12554
|
}
|
|
12487
12555
|
}, []);
|
|
12488
12556
|
const isConnected = config?.externalSession ? Boolean(collaboration?.doc) : collaboration?.status === "connected";
|
|
12557
|
+
const historyReady = pptx.collaborationHistoryReady({
|
|
12558
|
+
hasDoc: Boolean(doc),
|
|
12559
|
+
external: Boolean(config?.externalSession),
|
|
12560
|
+
connected: isConnected && !config?.externalSession,
|
|
12561
|
+
synced: collaboration?.synced ?? false,
|
|
12562
|
+
viewer: config?.role === "viewer"
|
|
12563
|
+
});
|
|
12564
|
+
const attachCollaboration = history?.attachCollaboration;
|
|
12565
|
+
React17.useEffect(() => {
|
|
12566
|
+
if (!attachCollaboration || !doc || !historyReady) {
|
|
12567
|
+
return;
|
|
12568
|
+
}
|
|
12569
|
+
return pptx.bindCollaborationHistory({ attachCollaboration }, doc, collabModules.loadYjs);
|
|
12570
|
+
}, [attachCollaboration, doc, historyReady]);
|
|
12489
12571
|
useYjsDocumentSync({
|
|
12490
12572
|
...state,
|
|
12491
12573
|
doc: collaboration?.doc ?? null,
|
|
@@ -12522,6 +12604,7 @@ function useViewerBuildingBlocksCollaboration(input) {
|
|
|
12522
12604
|
});
|
|
12523
12605
|
useCollaborationDocumentSync({
|
|
12524
12606
|
collaboration,
|
|
12607
|
+
history: input.core.history,
|
|
12525
12608
|
content: input.content,
|
|
12526
12609
|
slides: state.slides,
|
|
12527
12610
|
setSlides: state.setSlides,
|
|
@@ -12626,7 +12709,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
12626
12709
|
setEditTemplateMode: state.setEditTemplateMode,
|
|
12627
12710
|
setHeaderFooter: state.setHeaderFooter
|
|
12628
12711
|
});
|
|
12629
|
-
const { gridSpacingPx, visibleSlideIndexes, masterPseudoSlide } = useDerivedSlideState({
|
|
12712
|
+
const { gridSpacingPx, visibleSlideIndexes, masterPseudoSlide, slideSectionGroups } = useDerivedSlideState({
|
|
12630
12713
|
slides,
|
|
12631
12714
|
sections: state.sections,
|
|
12632
12715
|
customShows: state.customShows,
|
|
@@ -12685,6 +12768,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
12685
12768
|
setExitModeHandler,
|
|
12686
12769
|
masterPseudoSlide,
|
|
12687
12770
|
gridSpacingPx,
|
|
12771
|
+
slideSectionGroups,
|
|
12688
12772
|
// Multiplied against the pre-existing 2x baseline; see the matching
|
|
12689
12773
|
// comment in `PowerPointViewer.tsx`.
|
|
12690
12774
|
imageExportScale: 2 * pptx.resolveImageResolutionScale(viewerOptions),
|
|
@@ -13014,7 +13098,8 @@ function useViewerBuildingBlocks(input) {
|
|
|
13014
13098
|
onSlideCountChange,
|
|
13015
13099
|
onOpenSettings,
|
|
13016
13100
|
onOpenHeaderFooter,
|
|
13017
|
-
onOpenShareDialog
|
|
13101
|
+
onOpenShareDialog,
|
|
13102
|
+
onOpenLayoutGallery
|
|
13018
13103
|
} = input;
|
|
13019
13104
|
const collaborationConfig = pptx.resolveCollaborationConfig(input.collaboration);
|
|
13020
13105
|
const [collaborationReadOnly, setCollaborationReadOnly] = React17.useState(Boolean(collaborationConfig));
|
|
@@ -13062,6 +13147,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
13062
13147
|
presentation,
|
|
13063
13148
|
masterPseudoSlide,
|
|
13064
13149
|
gridSpacingPx,
|
|
13150
|
+
slideSectionGroups,
|
|
13065
13151
|
viewerOptions
|
|
13066
13152
|
} = core;
|
|
13067
13153
|
const canEdit = pptx.resolveCollaborationShellEditability({
|
|
@@ -13168,6 +13254,17 @@ function useViewerBuildingBlocks(input) {
|
|
|
13168
13254
|
${url}`
|
|
13169
13255
|
});
|
|
13170
13256
|
canvasProps.collaborationOverlay = overlay;
|
|
13257
|
+
const slidesPaneProps = useSlidesPaneProps({
|
|
13258
|
+
state,
|
|
13259
|
+
slides,
|
|
13260
|
+
canEdit,
|
|
13261
|
+
activeSlideIndex,
|
|
13262
|
+
slideSectionGroups,
|
|
13263
|
+
slideOps: editorOps.slideOps,
|
|
13264
|
+
sectionOps: editorOps.sectionOps,
|
|
13265
|
+
recordedTimings: presentation.recordedTimings,
|
|
13266
|
+
onOpenLayoutGallery
|
|
13267
|
+
});
|
|
13171
13268
|
const shellState = React17.useMemo(
|
|
13172
13269
|
() => pptx.resolveCollaborationShellState({
|
|
13173
13270
|
authorizedCanEdit: requestedCanEdit,
|
|
@@ -13192,6 +13289,7 @@ ${url}`
|
|
|
13192
13289
|
return {
|
|
13193
13290
|
toolbarProps,
|
|
13194
13291
|
canvasProps,
|
|
13292
|
+
slidesPaneProps,
|
|
13195
13293
|
mode,
|
|
13196
13294
|
loading,
|
|
13197
13295
|
error,
|
|
Binary file
|
|
Binary file
|