pptx-react-viewer 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +982 -0
  2. package/dist/PowerPointViewer-K2URyPlJ.d.mts +522 -0
  3. package/dist/PowerPointViewer-K2URyPlJ.d.ts +522 -0
  4. package/dist/index.d.mts +71 -0
  5. package/dist/index.d.ts +71 -0
  6. package/dist/index.js +121771 -0
  7. package/dist/index.mjs +121737 -0
  8. package/dist/pptx-viewer.css +2 -0
  9. package/dist/viewer/index.d.mts +267 -0
  10. package/dist/viewer/index.d.ts +267 -0
  11. package/dist/viewer/index.js +121947 -0
  12. package/dist/viewer/index.mjs +121908 -0
  13. package/node_modules/emf-converter/README.md +629 -0
  14. package/node_modules/emf-converter/dist/index.d.mts +86 -0
  15. package/node_modules/emf-converter/dist/index.d.ts +86 -0
  16. package/node_modules/emf-converter/dist/index.js +4199 -0
  17. package/node_modules/emf-converter/dist/index.mjs +4195 -0
  18. package/node_modules/emf-converter/package.json +42 -0
  19. package/node_modules/mtx-decompressor/README.md +271 -0
  20. package/node_modules/mtx-decompressor/dist/index.d.mts +83 -0
  21. package/node_modules/mtx-decompressor/dist/index.d.ts +83 -0
  22. package/node_modules/mtx-decompressor/dist/index.js +1510 -0
  23. package/node_modules/mtx-decompressor/dist/index.mjs +1506 -0
  24. package/node_modules/mtx-decompressor/package.json +37 -0
  25. package/node_modules/pptx-viewer-core/README.md +1294 -0
  26. package/node_modules/pptx-viewer-core/dist/SvgExporter-BZJguJbp.d.ts +557 -0
  27. package/node_modules/pptx-viewer-core/dist/SvgExporter-DqcmwxFu.d.mts +557 -0
  28. package/node_modules/pptx-viewer-core/dist/cli/index.d.mts +150 -0
  29. package/node_modules/pptx-viewer-core/dist/cli/index.d.ts +150 -0
  30. package/node_modules/pptx-viewer-core/dist/cli/index.js +39790 -0
  31. package/node_modules/pptx-viewer-core/dist/cli/index.mjs +39757 -0
  32. package/node_modules/pptx-viewer-core/dist/converter/index.d.mts +48 -0
  33. package/node_modules/pptx-viewer-core/dist/converter/index.d.ts +48 -0
  34. package/node_modules/pptx-viewer-core/dist/converter/index.js +3676 -0
  35. package/node_modules/pptx-viewer-core/dist/converter/index.mjs +3664 -0
  36. package/node_modules/pptx-viewer-core/dist/index.d.mts +10796 -0
  37. package/node_modules/pptx-viewer-core/dist/index.d.ts +10796 -0
  38. package/node_modules/pptx-viewer-core/dist/index.js +49658 -0
  39. package/node_modules/pptx-viewer-core/dist/index.mjs +49270 -0
  40. package/node_modules/pptx-viewer-core/dist/presentation-Bo7cMMCe.d.mts +4558 -0
  41. package/node_modules/pptx-viewer-core/dist/presentation-Bo7cMMCe.d.ts +4558 -0
  42. package/node_modules/pptx-viewer-core/dist/text-operations-Bo-WG-Z8.d.mts +134 -0
  43. package/node_modules/pptx-viewer-core/dist/text-operations-D0f1jred.d.ts +134 -0
  44. package/node_modules/pptx-viewer-core/package.json +61 -0
  45. package/package.json +89 -0
@@ -0,0 +1,267 @@
1
+ import { C as CollaborationConfig, d as ConnectionStatus, U as UserPresence, e as CollaborationContextValue } from '../PowerPointViewer-K2URyPlJ.js';
2
+ export { A as AccessibilityIssue, f as AnimationPresetOption, h as CanvasSize, i as ConnectorArrowOption, j as ConnectorGeometryOption, k as ConnectorGeometryType, l as ConnectorPathGeometry, D as DragState, m as DrawingTool, E as EditorHistorySnapshot, n as ElementBounds, o as ElementClipboardPayload, p as ElementContextMenuAction, q as ElementContextMenuState, F as FileViewerHandle, M as MarqueeSelectionState, r as ParsedTableCell, s as ParsedTableData, P as PowerPointViewer, b as PowerPointViewerHandle, c as PowerPointViewerProps, t as PresentationAnimationRuntime, R as ResizeHandle, u as ResizeState, S as ShapeAdjustmentDragState, v as ShapeAdjustmentHandleDescriptor, w as ShapePreset, x as ShapeQuickStyle, y as ShortcutReferenceItem, z as SlideAlignment, B as SlideSectionGroup, G as SlideTransitionOption, H as StrokeDashOption, I as SupportedShapeType, T as TableCellEditorState, J as ToolbarSection, K as ViewerMode, g as getAnimationInitialStyle } from '../PowerPointViewer-K2URyPlJ.js';
3
+ import { PptxThemePreset, PptxThemeColorScheme, PptxThemeFontScheme, PptxHandler, PptxData } from 'pptx-viewer-core';
4
+ import React__default, { RefObject } from 'react';
5
+
6
+ /** Returns true if the current page was opened as an audience tab. */
7
+ declare function isAudienceTab(): boolean;
8
+
9
+ /**
10
+ * Load PPTX content bytes stored by the presenter tab.
11
+ * Returns `null` if nothing is stored.
12
+ */
13
+ declare function loadAudienceContent(): Promise<Uint8Array | null>;
14
+ /**
15
+ * Remove stored audience content (cleanup).
16
+ */
17
+ declare function clearAudienceContent(): Promise<void>;
18
+
19
+ interface UseThemeSwitchingInput {
20
+ /** Ref to the PptxHandler instance. */
21
+ handlerRef: RefObject<PptxHandler | null>;
22
+ /** Current parsed presentation data (null when nothing is loaded). */
23
+ data: PptxData | null;
24
+ /** Callback to update the presentation data after theme switch. */
25
+ onDataChange: (newData: PptxData) => void;
26
+ /** Optional callback fired when theme switch completes successfully. */
27
+ onThemeChanged?: (preset: PptxThemePreset) => void;
28
+ }
29
+ interface ThemeSwitchingResult {
30
+ /** All available built-in theme presets. */
31
+ presets: readonly PptxThemePreset[];
32
+ /**
33
+ * Apply a theme preset to the current presentation.
34
+ * Updates both the in-memory ZIP and all resolved element colours.
35
+ */
36
+ switchToPreset: (preset: PptxThemePreset) => Promise<void>;
37
+ /**
38
+ * Apply a custom colour scheme (and optional font scheme) to the
39
+ * current presentation.
40
+ */
41
+ switchToCustom: (colorScheme: PptxThemeColorScheme, fontScheme?: PptxThemeFontScheme, themeName?: string) => Promise<void>;
42
+ /**
43
+ * Get the preset matching the current presentation theme (if any).
44
+ * Returns undefined if the current theme does not match a built-in preset.
45
+ */
46
+ currentPreset: PptxThemePreset | undefined;
47
+ }
48
+ /**
49
+ * React hook providing theme switching capabilities for the PowerPoint viewer.
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * const { presets, switchToPreset, currentPreset } = useThemeSwitching({
54
+ * handlerRef,
55
+ * data,
56
+ * onDataChange: setData,
57
+ * });
58
+ *
59
+ * return (
60
+ * <div>
61
+ * {presets.map(preset => (
62
+ * <button
63
+ * key={preset.id}
64
+ * onClick={() => switchToPreset(preset)}
65
+ * aria-pressed={preset.id === currentPreset?.id}
66
+ * >
67
+ * {preset.name}
68
+ * </button>
69
+ * ))}
70
+ * </div>
71
+ * );
72
+ * ```
73
+ */
74
+ declare function useThemeSwitching(input: UseThemeSwitchingInput): ThemeSwitchingResult;
75
+
76
+ interface YDoc {
77
+ destroy: () => void;
78
+ getMap: (name: string) => any;
79
+ getArray: (name: string) => any;
80
+ }
81
+ interface Awareness$1 {
82
+ setLocalStateField: (field: string, value: any) => void;
83
+ getLocalState: () => any;
84
+ getStates: () => Map<number, any>;
85
+ on: (event: string, cb: (...args: any[]) => void) => void;
86
+ off: (event: string, cb: (...args: any[]) => void) => void;
87
+ clientID: number;
88
+ }
89
+ interface UseYjsProviderInput {
90
+ config: CollaborationConfig;
91
+ }
92
+ interface UseYjsProviderResult {
93
+ /** Current WebSocket connection status. */
94
+ status: ConnectionStatus;
95
+ /** The Yjs awareness instance (null until connected). */
96
+ awareness: Awareness$1 | null;
97
+ /** The Yjs document (null until initialised). */
98
+ doc: YDoc | null;
99
+ /** Local awareness client ID. */
100
+ clientId: number | null;
101
+ }
102
+ /**
103
+ * Lazily loads `yjs` and `y-websocket`, creates a Y.Doc and
104
+ * WebSocketProvider, and tracks the connection lifecycle.
105
+ *
106
+ * The Yjs packages are dynamically imported so they are fully
107
+ * tree-shaken when collaboration is not enabled.
108
+ */
109
+ declare function useYjsProvider({ config }: UseYjsProviderInput): UseYjsProviderResult;
110
+
111
+ interface Awareness {
112
+ setLocalStateField: (field: string, value: any) => void;
113
+ getLocalState: () => any;
114
+ getStates: () => Map<number, any>;
115
+ on: (event: string, cb: (...args: any[]) => void) => void;
116
+ off: (event: string, cb: (...args: any[]) => void) => void;
117
+ clientID: number;
118
+ }
119
+ interface UsePresenceTrackingInput {
120
+ awareness: Awareness | null;
121
+ localClientId: number | null;
122
+ userName: string;
123
+ userColor: string;
124
+ userAvatar?: string;
125
+ canvasWidth: number;
126
+ canvasHeight: number;
127
+ }
128
+ interface UsePresenceTrackingResult {
129
+ /** Presence data for all remote users (excludes local). */
130
+ remoteUsers: UserPresence[];
131
+ /** Broadcast a partial presence update for the local user. */
132
+ broadcastPresence: (update: Partial<Omit<UserPresence, 'clientId'>>) => void;
133
+ }
134
+ declare function usePresenceTracking({ awareness, localClientId, userName, userColor, userAvatar, canvasWidth, canvasHeight, }: UsePresenceTrackingInput): UsePresenceTrackingResult;
135
+
136
+ /**
137
+ * useCollaborativeState — Composes the Yjs provider and presence tracking
138
+ * into a single hook for the collaboration system.
139
+ *
140
+ * This is the primary hook consumed by the `CollaborationProvider` context.
141
+ * It orchestrates:
142
+ * - Yjs WebSocket connection lifecycle
143
+ * - Presence tracking (broadcast + receive)
144
+ * - Connection status
145
+ *
146
+ * @module collaboration/useCollaborativeState
147
+ */
148
+
149
+ interface UseCollaborativeStateInput {
150
+ config: CollaborationConfig;
151
+ canvasWidth: number;
152
+ canvasHeight: number;
153
+ }
154
+ declare function useCollaborativeState({ config, canvasWidth, canvasHeight, }: UseCollaborativeStateInput): CollaborationContextValue;
155
+
156
+ interface UseCollaborativeHistoryInput {
157
+ /** The local user's client ID (from Yjs awareness). */
158
+ localClientId: number | null;
159
+ /** Standard history undo function. */
160
+ handleUndo: () => void;
161
+ /** Standard history redo function. */
162
+ handleRedo: () => void;
163
+ /** Whether undo is available. */
164
+ canUndo: boolean;
165
+ /** Whether redo is available. */
166
+ canRedo: boolean;
167
+ }
168
+ interface UseCollaborativeHistoryResult {
169
+ /** Undo the last local change. */
170
+ handleUndo: () => void;
171
+ /** Redo the last undone local change. */
172
+ handleRedo: () => void;
173
+ /** Whether undo is available. */
174
+ canUndo: boolean;
175
+ /** Whether redo is available. */
176
+ canRedo: boolean;
177
+ }
178
+ declare function useCollaborativeHistory({ localClientId: _localClientId, handleUndo, handleRedo, canUndo, canRedo, }: UseCollaborativeHistoryInput): UseCollaborativeHistoryResult;
179
+
180
+ /**
181
+ * CollaborationProvider — React context provider for real-time collaboration.
182
+ *
183
+ * Wraps the viewer content and exposes collaboration state (connection status,
184
+ * remote user presence, broadcast function) to all child components via
185
+ * `useCollaboration()`.
186
+ *
187
+ * This component is only rendered when `collaboration` config is provided to
188
+ * `PowerPointViewer`, ensuring zero bundle/runtime cost when unused.
189
+ *
190
+ * @module collaboration/CollaborationProvider
191
+ */
192
+
193
+ interface CollaborationProviderProps {
194
+ config: CollaborationConfig;
195
+ canvasWidth: number;
196
+ canvasHeight: number;
197
+ children: React__default.ReactNode;
198
+ }
199
+ declare function CollaborationProvider({ config, canvasWidth, canvasHeight, children, }: CollaborationProviderProps): React__default.ReactElement;
200
+
201
+ /**
202
+ * RemoteUserCursors — Renders other users' cursors as an SVG overlay
203
+ * on the slide canvas.
204
+ *
205
+ * Each remote user's cursor is drawn as a coloured pointer arrow with
206
+ * their username label. Only cursors on the same slide as the local
207
+ * user are displayed.
208
+ *
209
+ * @module collaboration/RemoteUserCursors
210
+ */
211
+
212
+ interface RemoteUserCursorsProps {
213
+ /** Presence data for remote users. */
214
+ remoteUsers: UserPresence[];
215
+ /** The slide index the local user is currently viewing. */
216
+ activeSlideIndex: number;
217
+ /** Canvas width in CSS px (for SVG viewBox). */
218
+ canvasWidth: number;
219
+ /** Canvas height in CSS px (for SVG viewBox). */
220
+ canvasHeight: number;
221
+ }
222
+ declare function RemoteUserCursors({ remoteUsers, activeSlideIndex, canvasWidth, canvasHeight, }: RemoteUserCursorsProps): React__default.ReactElement | null;
223
+
224
+ /**
225
+ * UserAvatarBar — Displays connected collaborators as a row of avatar circles
226
+ * in the toolbar area.
227
+ *
228
+ * Shows up to 5 avatar circles with a "+N" overflow indicator.
229
+ * Each circle shows the user's avatar image (if available) or their initials.
230
+ *
231
+ * @module collaboration/UserAvatarBar
232
+ */
233
+
234
+ interface UserAvatarBarProps {
235
+ /** Remote user presence data. */
236
+ remoteUsers: UserPresence[];
237
+ /** Local user display name. */
238
+ localUserName: string;
239
+ /** Local user's colour. */
240
+ localUserColor: string;
241
+ /** Local user's avatar URL. */
242
+ localUserAvatar?: string;
243
+ /** Connection status. */
244
+ status: ConnectionStatus;
245
+ /** Maximum visible avatars before showing overflow (default: 5). */
246
+ maxVisible?: number;
247
+ }
248
+ declare function UserAvatarBar({ remoteUsers, localUserName, localUserColor, localUserAvatar, status, maxVisible, }: UserAvatarBarProps): React__default.ReactElement | null;
249
+
250
+ /**
251
+ * CollaborationStatusIndicator — A small status pill that shows the
252
+ * WebSocket connection state and connected user count.
253
+ *
254
+ * Designed to sit in the status bar area at the bottom of the viewer.
255
+ *
256
+ * @module collaboration/CollaborationStatusIndicator
257
+ */
258
+
259
+ interface CollaborationStatusIndicatorProps {
260
+ /** Current WebSocket connection status. */
261
+ status: ConnectionStatus;
262
+ /** Number of connected users (including local). */
263
+ connectedCount: number;
264
+ }
265
+ declare function CollaborationStatusIndicator({ status, connectedCount, }: CollaborationStatusIndicatorProps): React__default.ReactElement;
266
+
267
+ export { CollaborationConfig, CollaborationContextValue, CollaborationProvider, CollaborationStatusIndicator, type CollaborationStatusIndicatorProps, ConnectionStatus, RemoteUserCursors, type RemoteUserCursorsProps, type ThemeSwitchingResult, type UseCollaborativeHistoryResult, type UseCollaborativeStateInput, type UsePresenceTrackingResult, type UseThemeSwitchingInput, UserAvatarBar, type UserAvatarBarProps, UserPresence, clearAudienceContent, isAudienceTab, loadAudienceContent, useCollaborativeHistory, useCollaborativeState, usePresenceTracking, useThemeSwitching, useYjsProvider };