pptx-react-viewer 1.0.10 → 1.0.11
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/README.md +68 -0
- package/dist/{PowerPointViewer-K2URyPlJ.d.mts → PowerPointViewer-gSKLhZDo.d.mts} +35 -1
- package/dist/{PowerPointViewer-K2URyPlJ.d.ts → PowerPointViewer-gSKLhZDo.d.ts} +35 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2532 -882
- package/dist/index.mjs +2533 -883
- package/dist/pptx-viewer.css +1 -1
- package/dist/viewer/index.d.mts +15 -3
- package/dist/viewer/index.d.ts +15 -3
- package/dist/viewer/index.js +2731 -985
- package/dist/viewer/index.mjs +2732 -987
- package/node_modules/emf-converter/package.json +1 -1
- package/node_modules/mtx-decompressor/package.json +1 -1
- package/node_modules/pptx-viewer-core/dist/{SvgExporter-DqcmwxFu.d.mts → SvgExporter-B4-1_Hjp.d.mts} +1 -1
- package/node_modules/pptx-viewer-core/dist/{SvgExporter-BZJguJbp.d.ts → SvgExporter-CPr1npgo.d.ts} +1 -1
- package/node_modules/pptx-viewer-core/dist/cli/index.d.mts +2 -2
- package/node_modules/pptx-viewer-core/dist/cli/index.d.ts +2 -2
- package/node_modules/pptx-viewer-core/dist/converter/index.d.mts +3 -3
- package/node_modules/pptx-viewer-core/dist/converter/index.d.ts +3 -3
- package/node_modules/pptx-viewer-core/dist/index.d.mts +5 -5
- package/node_modules/pptx-viewer-core/dist/index.d.ts +5 -5
- package/node_modules/pptx-viewer-core/dist/{presentation-Bo7cMMCe.d.mts → presentation-DgkIYhXo.d.mts} +6 -0
- package/node_modules/pptx-viewer-core/dist/{presentation-Bo7cMMCe.d.ts → presentation-DgkIYhXo.d.ts} +6 -0
- package/node_modules/pptx-viewer-core/dist/{text-operations-D0f1jred.d.ts → text-operations-B6U6XxWt.d.ts} +1 -1
- package/node_modules/pptx-viewer-core/dist/{text-operations-Bo-WG-Z8.d.mts → text-operations-dYKZp3zE.d.mts} +1 -1
- package/node_modules/pptx-viewer-core/package.json +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -40,6 +40,9 @@ A full-featured **React** component for viewing, editing, and presenting PowerPo
|
|
|
40
40
|
- [Hooks Reference](#hooks-reference)
|
|
41
41
|
- [Utility Modules Reference](#utility-modules-reference)
|
|
42
42
|
- [File Structure Reference](#file-structure-reference)
|
|
43
|
+
- [Localization (i18n)](#localization-i18n)
|
|
44
|
+
- [Setup](#setup)
|
|
45
|
+
- [How it works](#how-it-works)
|
|
43
46
|
- [Limitations](#limitations)
|
|
44
47
|
|
|
45
48
|
---
|
|
@@ -767,6 +770,71 @@ src/
|
|
|
767
770
|
|
|
768
771
|
---
|
|
769
772
|
|
|
773
|
+
## Localization (i18n)
|
|
774
|
+
|
|
775
|
+
The viewer uses [i18next](https://www.i18next.com/) with [react-i18next](https://react.i18next.com/) for UI labels. Components call `useTranslation()` and look up dotted keys such as `t('pptx.statusBar.allSaved')`.
|
|
776
|
+
|
|
777
|
+
### Setup
|
|
778
|
+
|
|
779
|
+
Initialise an i18next instance with your translations and wrap your app in the `I18nextProvider` (or call `i18next.init()` before rendering). The demo app (`demo/i18n.ts`) shows a minimal configuration:
|
|
780
|
+
|
|
781
|
+
```ts
|
|
782
|
+
import { createInstance } from 'i18next';
|
|
783
|
+
import { initReactI18next } from 'react-i18next';
|
|
784
|
+
|
|
785
|
+
const i18n = createInstance();
|
|
786
|
+
|
|
787
|
+
i18n.use(initReactI18next).init({
|
|
788
|
+
resources: {
|
|
789
|
+
en: {
|
|
790
|
+
translation: {
|
|
791
|
+
'pptx.statusBar.allSaved': 'All saved',
|
|
792
|
+
'pptx.sections.addSlide': 'Add Slide',
|
|
793
|
+
'pptx.notes.clickToAddNotes': 'Click to add notes',
|
|
794
|
+
// ... see demo/i18n.ts for the full key list
|
|
795
|
+
},
|
|
796
|
+
},
|
|
797
|
+
},
|
|
798
|
+
lng: 'en',
|
|
799
|
+
fallbackLng: 'en',
|
|
800
|
+
interpolation: { escapeValue: false },
|
|
801
|
+
// Optional: derive display text from dotted keys for undefined keys
|
|
802
|
+
parseMissingKeyHandler: (key) => {
|
|
803
|
+
const last = key.split('.').pop() ?? key;
|
|
804
|
+
return last.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/^./, (c) => c.toUpperCase());
|
|
805
|
+
},
|
|
806
|
+
});
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
To add a new language, add a resource bundle under its language code (e.g. `fr`, `de`) and set `lng` accordingly.
|
|
810
|
+
|
|
811
|
+
### How it works
|
|
812
|
+
|
|
813
|
+
Translation keys follow the pattern `pptx.<area>.<label>` (e.g. `pptx.slideSorter.zoomIn`, `pptx.comments.addComment`). The demo configures a `parseMissingKeyHandler` that converts any undefined key into a Title Case label automatically, so components can reference keys that are not explicitly listed and still render sensible English text.
|
|
814
|
+
|
|
815
|
+
Key namespaces currently in use:
|
|
816
|
+
|
|
817
|
+
| Namespace | Examples |
|
|
818
|
+
| ----------------------- | ---------------------------------------------- |
|
|
819
|
+
| `pptx.statusBar.*` | `allSaved`, `unsavedChanges` |
|
|
820
|
+
| `pptx.autosave.*` | `saving`, `saved`, `error` |
|
|
821
|
+
| `pptx.sections.*` | `addSlide`, `addSection`, `rename`, `delete` |
|
|
822
|
+
| `pptx.notes.*` | `slideN`, `clickToAddNotes`, `noNotes` |
|
|
823
|
+
| `pptx.slideSorter.*` | `zoomIn`, `zoomOut`, `close` |
|
|
824
|
+
| `pptx.grid.*` | `toggleGrid`, `snapToGrid` |
|
|
825
|
+
| `pptx.field.*` | `insertField`, `slideNumber`, `dateTime` |
|
|
826
|
+
| `pptx.master.*` | `layout`, `noMasters` |
|
|
827
|
+
| `pptx.export.*` | `processing`, `cancel` |
|
|
828
|
+
| `pptx.versionHistory.*` | `restore`, `noVersions` |
|
|
829
|
+
| `pptx.presenter.*` | `speakerNotes`, `nextSlidePreview` |
|
|
830
|
+
| `pptx.presentation.*` | `pen`, `highlighter`, `eraser`, `laserPointer` |
|
|
831
|
+
| `pptx.selectionPane.*` | `show`, `hide`, `close` |
|
|
832
|
+
| `pptx.inspector.*` | `element`, `noSlideSelected` |
|
|
833
|
+
| `pptx.comments.*` | `addComment`, `noComments` |
|
|
834
|
+
| `pptx.encryptedFile.*` | `title`, `message`, `instructions` |
|
|
835
|
+
|
|
836
|
+
---
|
|
837
|
+
|
|
770
838
|
## Limitations
|
|
771
839
|
|
|
772
840
|
- **CSS-based rendering** -- Slides are rendered as HTML/CSS rather than Canvas, which gives sharp text at any zoom, native accessibility, and DOM interactivity. The tradeoff is that some visual effects are approximated: `backdrop-filter` is replaced with semi-transparent backgrounds, `mix-blend-mode` is mapped to opacity fallbacks, and CSS 3D transforms (rotateX/Y) are flattened to 2D. Path gradients are approximated as elliptical radials.
|
|
@@ -316,6 +316,8 @@ interface CollaborationContextValue {
|
|
|
316
316
|
connectedCount: number;
|
|
317
317
|
/** The collaboration config that was provided. */
|
|
318
318
|
config: CollaborationConfig;
|
|
319
|
+
/** The Yjs document (for document sync). */
|
|
320
|
+
doc: unknown | null;
|
|
319
321
|
}
|
|
320
322
|
|
|
321
323
|
/**
|
|
@@ -405,7 +407,7 @@ interface SlideSectionGroup {
|
|
|
405
407
|
/** Alignment direction for distributing/aligning multiple selected elements on the slide. */
|
|
406
408
|
type SlideAlignment = 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom';
|
|
407
409
|
/** Identifies one of the ribbon-style toolbar tabs (home, insert, text, etc.). */
|
|
408
|
-
type ToolbarSection = 'home' | 'insert' | 'text' | 'arrange' | 'draw' | 'design' | 'transitions' | 'review' | 'view';
|
|
410
|
+
type ToolbarSection = 'file' | 'home' | 'insert' | 'text' | 'arrange' | 'draw' | 'design' | 'transitions' | 'animations' | 'slideShow' | 'review' | 'view' | 'help';
|
|
409
411
|
/** The active drawing/inking tool selected in the Draw toolbar tab. */
|
|
410
412
|
type DrawingTool = 'select' | 'pen' | 'highlighter' | 'eraser' | 'freeform';
|
|
411
413
|
/** A single entry in the keyboard shortcuts help panel. */
|
|
@@ -501,6 +503,38 @@ interface PowerPointViewerProps {
|
|
|
501
503
|
* ```
|
|
502
504
|
*/
|
|
503
505
|
collaboration?: CollaborationConfig;
|
|
506
|
+
/**
|
|
507
|
+
* Callback invoked when the user starts a collaboration session from the
|
|
508
|
+
* Share dialog. The host app should use this to set the `collaboration`
|
|
509
|
+
* prop with the returned config.
|
|
510
|
+
*/
|
|
511
|
+
onStartCollaboration?: (config: CollaborationConfig) => void;
|
|
512
|
+
/**
|
|
513
|
+
* Callback invoked when the user stops a collaboration session from the
|
|
514
|
+
* Share dialog. The host app should clear the `collaboration` prop.
|
|
515
|
+
*/
|
|
516
|
+
onStopCollaboration?: () => void;
|
|
517
|
+
/**
|
|
518
|
+
* Default values for the Share dialog fields. The host app should provide
|
|
519
|
+
* these to control the session name, user display name, and server URL.
|
|
520
|
+
* If omitted, the Share dialog fields will be empty and require user input.
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* ```tsx
|
|
524
|
+
* <PowerPointViewer
|
|
525
|
+
* shareDefaults={{
|
|
526
|
+
* roomId: "session-abc123",
|
|
527
|
+
* userName: "Alice",
|
|
528
|
+
* serverUrl: "ws://localhost:1234",
|
|
529
|
+
* }}
|
|
530
|
+
* />
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
shareDefaults?: {
|
|
534
|
+
roomId?: string;
|
|
535
|
+
userName?: string;
|
|
536
|
+
serverUrl?: string;
|
|
537
|
+
};
|
|
504
538
|
}
|
|
505
539
|
interface PowerPointViewerHandle extends FileViewerHandle {
|
|
506
540
|
getContent: () => Promise<Uint8Array>;
|
|
@@ -316,6 +316,8 @@ interface CollaborationContextValue {
|
|
|
316
316
|
connectedCount: number;
|
|
317
317
|
/** The collaboration config that was provided. */
|
|
318
318
|
config: CollaborationConfig;
|
|
319
|
+
/** The Yjs document (for document sync). */
|
|
320
|
+
doc: unknown | null;
|
|
319
321
|
}
|
|
320
322
|
|
|
321
323
|
/**
|
|
@@ -405,7 +407,7 @@ interface SlideSectionGroup {
|
|
|
405
407
|
/** Alignment direction for distributing/aligning multiple selected elements on the slide. */
|
|
406
408
|
type SlideAlignment = 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom';
|
|
407
409
|
/** Identifies one of the ribbon-style toolbar tabs (home, insert, text, etc.). */
|
|
408
|
-
type ToolbarSection = 'home' | 'insert' | 'text' | 'arrange' | 'draw' | 'design' | 'transitions' | 'review' | 'view';
|
|
410
|
+
type ToolbarSection = 'file' | 'home' | 'insert' | 'text' | 'arrange' | 'draw' | 'design' | 'transitions' | 'animations' | 'slideShow' | 'review' | 'view' | 'help';
|
|
409
411
|
/** The active drawing/inking tool selected in the Draw toolbar tab. */
|
|
410
412
|
type DrawingTool = 'select' | 'pen' | 'highlighter' | 'eraser' | 'freeform';
|
|
411
413
|
/** A single entry in the keyboard shortcuts help panel. */
|
|
@@ -501,6 +503,38 @@ interface PowerPointViewerProps {
|
|
|
501
503
|
* ```
|
|
502
504
|
*/
|
|
503
505
|
collaboration?: CollaborationConfig;
|
|
506
|
+
/**
|
|
507
|
+
* Callback invoked when the user starts a collaboration session from the
|
|
508
|
+
* Share dialog. The host app should use this to set the `collaboration`
|
|
509
|
+
* prop with the returned config.
|
|
510
|
+
*/
|
|
511
|
+
onStartCollaboration?: (config: CollaborationConfig) => void;
|
|
512
|
+
/**
|
|
513
|
+
* Callback invoked when the user stops a collaboration session from the
|
|
514
|
+
* Share dialog. The host app should clear the `collaboration` prop.
|
|
515
|
+
*/
|
|
516
|
+
onStopCollaboration?: () => void;
|
|
517
|
+
/**
|
|
518
|
+
* Default values for the Share dialog fields. The host app should provide
|
|
519
|
+
* these to control the session name, user display name, and server URL.
|
|
520
|
+
* If omitted, the Share dialog fields will be empty and require user input.
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* ```tsx
|
|
524
|
+
* <PowerPointViewer
|
|
525
|
+
* shareDefaults={{
|
|
526
|
+
* roomId: "session-abc123",
|
|
527
|
+
* userName: "Alice",
|
|
528
|
+
* serverUrl: "ws://localhost:1234",
|
|
529
|
+
* }}
|
|
530
|
+
* />
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
shareDefaults?: {
|
|
534
|
+
roomId?: string;
|
|
535
|
+
userName?: string;
|
|
536
|
+
serverUrl?: string;
|
|
537
|
+
};
|
|
504
538
|
}
|
|
505
539
|
interface PowerPointViewerHandle extends FileViewerHandle {
|
|
506
540
|
getContent: () => Promise<Uint8Array>;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as ViewerThemeColors, a as ViewerTheme } from './PowerPointViewer-
|
|
2
|
-
export { P as PowerPointViewer, b as PowerPointViewerHandle, c as PowerPointViewerProps, g as getAnimationInitialStyle } from './PowerPointViewer-
|
|
1
|
+
import { V as ViewerThemeColors, a as ViewerTheme } from './PowerPointViewer-gSKLhZDo.mjs';
|
|
2
|
+
export { P as PowerPointViewer, b as PowerPointViewerHandle, c as PowerPointViewerProps, g as getAnimationInitialStyle } from './PowerPointViewer-gSKLhZDo.mjs';
|
|
3
3
|
import { Options } from 'html2canvas-pro';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import 'pptx-viewer-core';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as ViewerThemeColors, a as ViewerTheme } from './PowerPointViewer-
|
|
2
|
-
export { P as PowerPointViewer, b as PowerPointViewerHandle, c as PowerPointViewerProps, g as getAnimationInitialStyle } from './PowerPointViewer-
|
|
1
|
+
import { V as ViewerThemeColors, a as ViewerTheme } from './PowerPointViewer-gSKLhZDo.js';
|
|
2
|
+
export { P as PowerPointViewer, b as PowerPointViewerHandle, c as PowerPointViewerProps, g as getAnimationInitialStyle } from './PowerPointViewer-gSKLhZDo.js';
|
|
3
3
|
import { Options } from 'html2canvas-pro';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import 'pptx-viewer-core';
|