pptx-react-viewer 4.62.0 → 4.62.2

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.
@@ -14,7 +14,6 @@ export { CollaborationState } from 'ooxml-core/collab';
14
14
  import * as Y from 'yjs';
15
15
  import { Doc } from 'yjs';
16
16
 
17
- //#region src/viewer/types-core.d.ts
18
17
  /**
19
18
  * Union of all shape preset types that the viewer can insert or render.
20
19
  * Maps to OOXML `a:prstGeom` preset values (e.g. "rect", "ellipse").
@@ -136,8 +135,6 @@ interface ShapeQuickStyle {
136
135
  name: string;
137
136
  style: Partial<ShapeStyle>;
138
137
  }
139
- //#endregion
140
- //#region src/viewer/hooks/collaboration/types.d.ts
141
138
  /** Connection lifecycle states for the Yjs WebSocket provider. */
142
139
  type ConnectionStatus$1 = 'disconnected' | 'connecting' | 'connected' | 'error';
143
140
  /**
@@ -194,15 +191,11 @@ interface CollaborationContextValue {
194
191
  /** Called by the document sync with the write-back status (undefined clears it). */
195
192
  reportWriteBack?: (state: CollaborationWriteBackState | undefined) => void;
196
193
  }
197
- //#endregion
198
- //#region src/viewer/hooks/useLoadNotifications.d.ts
199
194
  /** What `onLoad` reports: the same detail the Svelte and vanilla bindings send. */
200
195
  interface ViewerLoadDetail {
201
196
  slideCount: number;
202
197
  canvasSize: CanvasSize;
203
198
  }
204
- //#endregion
205
- //#region src/viewer/types-ui.d.ts
206
199
  /**
207
200
  * Base handle interface for file viewer components.
208
201
  * Defined locally to avoid dependency on external file-viewer plugin packages.
@@ -760,10 +753,7 @@ interface PowerPointViewerHandle extends FileViewerHandle, PowerPointViewerAPI,
760
753
  getContent: () => Promise<Uint8Array>;
761
754
  }
762
755
 
763
- //#region src/viewer/utils/animation-effects.d.ts
764
756
  declare function getAnimationInitialStyle(preset: PptxAnimationPreset | undefined, nativeAnimation?: PptxNativeAnimation): React__default.CSSProperties;
765
- //#endregion
766
- //#region src/viewer/PowerPointViewer.d.ts
767
757
  /**
768
758
  * Root React component for the PowerPoint viewer/editor.
769
759
  *
@@ -774,8 +764,6 @@ declare function getAnimationInitialStyle(preset: PptxAnimationPreset | undefine
774
764
  * access (e.g. serialising the current content for saving).
775
765
  */
776
766
  declare const PowerPointViewer: React.ForwardRefExoticComponent<PowerPointViewerProps & React.RefAttributes<PowerPointViewerHandle>>;
777
- //#endregion
778
- //#region src/viewer/i18n/types.d.ts
779
767
  /** What the viewer passes `translate`: exactly the params of the call. */
780
768
  interface PptxTranslateParams {
781
769
  readonly defaultValue?: string;
@@ -788,8 +776,6 @@ interface PptxTranslateParams {
788
776
  * translation": the viewer then shows its built-in English text.
789
777
  */
790
778
  type PptxTranslate = (key: string, params?: PptxTranslateParams) => string | null | undefined;
791
- //#endregion
792
- //#region src/viewer/i18n/provider.d.ts
793
779
  interface PptxI18nProviderProps {
794
780
  /**
795
781
  * Translates a viewer key; see {@link PptxTranslate}. Keep it referentially stable (a
@@ -814,7 +800,6 @@ interface PptxI18nProviderProps {
814
800
  */
815
801
  declare function PptxI18nProvider({ translate, locale, children }: PptxI18nProviderProps): ReactElement;
816
802
 
817
- //#region src/viewer/hooks/useThemeSwitching.d.ts
818
803
  interface UseThemeSwitchingInput {
819
804
  /** Ref to the PptxHandler instance. */
820
805
  handlerRef: RefObject<PptxHandler | null>;
@@ -871,8 +856,6 @@ interface ThemeSwitchingResult {
871
856
  * ```
872
857
  */
873
858
  declare function useThemeSwitching(input: UseThemeSwitchingInput): ThemeSwitchingResult;
874
- //#endregion
875
- //#region ../../../../node_modules/.bun/lib0@0.2.119/node_modules/lib0/observable.d.ts
876
859
  /**
877
860
  * Handles named events.
878
861
  *
@@ -912,8 +895,6 @@ declare class Observable<N> {
912
895
  emit(name: N, args: Array<any>): void;
913
896
  destroy(): void;
914
897
  }
915
- //#endregion
916
- //#region ../../../../node_modules/.bun/y-protocols@1.0.7+dd3713061a4ad7f6/node_modules/y-protocols/awareness.d.ts
917
898
  /**
918
899
  * @typedef {Object} MetaClientState
919
900
  * @property {number} MetaClientState.clock
@@ -990,8 +971,6 @@ type MetaClientState = {
990
971
  */
991
972
  lastUpdated: number;
992
973
  };
993
- //#endregion
994
- //#region src/viewer/hooks/collaboration/useYjsProvider.d.ts
995
974
  interface UseYjsProviderInput {
996
975
  /**
997
976
  * Collaboration config, or `undefined` when collaboration is inactive. The
@@ -1030,8 +1009,6 @@ interface UseYjsProviderResult {
1030
1009
  * (or the full/headless viewer) to attach a host-owned external session.
1031
1010
  */
1032
1011
  declare function useYjsProvider({ config: inputConfig }: UseYjsProviderInput): UseYjsProviderResult;
1033
- //#endregion
1034
- //#region src/viewer/hooks/collaboration/usePresenceTracking.d.ts
1035
1012
  interface UsePresenceTrackingInput {
1036
1013
  awareness: Awareness | BorrowedCollaborationAwareness | null;
1037
1014
  localClientId: number | null;
@@ -1050,8 +1027,6 @@ interface UsePresenceTrackingResult {
1050
1027
  broadcastPresence: (update: Partial<Omit<UserPresence, 'clientId'>>) => void;
1051
1028
  }
1052
1029
  declare function usePresenceTracking({ awareness, localClientId, userName, userColor, userAvatar, role, canvasWidth, canvasHeight }: UsePresenceTrackingInput): UsePresenceTrackingResult;
1053
- //#endregion
1054
- //#region src/viewer/hooks/collaboration/useCollaborativeState.d.ts
1055
1030
  interface UseCollaborativeStateInput {
1056
1031
  /**
1057
1032
  * Collaboration config, or `undefined` when collaboration is inactive. The
@@ -1064,8 +1039,6 @@ interface UseCollaborativeStateInput {
1064
1039
  canvasHeight: number;
1065
1040
  }
1066
1041
  declare function useCollaborativeState({ config: requested, canvasWidth, canvasHeight }: UseCollaborativeStateInput): CollaborationContextValue | null;
1067
- //#endregion
1068
- //#region src/viewer/hooks/collaboration/useCollaborativeHistory.d.ts
1069
1042
  interface UseCollaborativeHistoryInput {
1070
1043
  /** The local user's client ID (from Yjs awareness). */
1071
1044
  localClientId: number | null;
@@ -1089,8 +1062,6 @@ interface UseCollaborativeHistoryResult {
1089
1062
  canRedo: boolean;
1090
1063
  }
1091
1064
  declare function useCollaborativeHistory({ localClientId: _localClientId, handleUndo, handleRedo, canUndo, canRedo }: UseCollaborativeHistoryInput): UseCollaborativeHistoryResult;
1092
- //#endregion
1093
- //#region src/viewer/hooks/presentation-mode/usePresenterWindow.d.ts
1094
1065
  /**
1095
1066
  * Parse the session nonce from the current page URL hash. Returns null if the
1096
1067
  * hash is not in the expected `#pptx-audience&nonce=<uuid>` form.
@@ -1099,7 +1070,6 @@ declare function parseAudienceNonce(): string | null;
1099
1070
  /** Returns true if the current page was opened as an audience tab. */
1100
1071
  declare function isAudienceTab(): boolean;
1101
1072
 
1102
- //#region src/viewer/components/collaboration/CollaborationProvider.d.ts
1103
1073
  interface CollaborationProviderProps {
1104
1074
  /** Collaboration config, or `undefined`/omitted while no session is active. */
1105
1075
  config?: CollaborationConfig;
@@ -1108,8 +1078,6 @@ interface CollaborationProviderProps {
1108
1078
  children: React__default.ReactNode;
1109
1079
  }
1110
1080
  declare function CollaborationProvider({ config, canvasWidth, canvasHeight, children }: CollaborationProviderProps): React__default.ReactElement;
1111
- //#endregion
1112
- //#region src/viewer/components/collaboration/RemoteUserCursors.d.ts
1113
1081
  interface RemoteUserCursorsProps {
1114
1082
  /** Presence data for remote users. */
1115
1083
  remoteUsers: UserPresence[];
@@ -1121,8 +1089,6 @@ interface RemoteUserCursorsProps {
1121
1089
  canvasHeight: number;
1122
1090
  }
1123
1091
  declare function RemoteUserCursors({ remoteUsers, activeSlideIndex, canvasWidth, canvasHeight }: RemoteUserCursorsProps): React__default.ReactElement | null;
1124
- //#endregion
1125
- //#region src/viewer/components/collaboration/UserAvatarBar.d.ts
1126
1092
  interface UserAvatarBarProps {
1127
1093
  /** Remote user presence data. */
1128
1094
  remoteUsers: UserPresence[];
@@ -1138,8 +1104,6 @@ interface UserAvatarBarProps {
1138
1104
  maxVisible?: number;
1139
1105
  }
1140
1106
  declare function UserAvatarBar({ remoteUsers, localUserName, localUserColor, localUserAvatar, status, maxVisible }: UserAvatarBarProps): React__default.ReactElement | null;
1141
- //#endregion
1142
- //#region src/viewer/components/collaboration/CollaborationStatusIndicator.d.ts
1143
1107
  interface CollaborationStatusIndicatorProps {
1144
1108
  /** Current WebSocket connection status. */
1145
1109
  status: ConnectionStatus$1;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkQIETGQJD_js = require('../chunk-QIETGQJD.js');
3
+ var chunkJSVQTF3Z_js = require('../chunk-JSVQTF3Z.js');
4
4
  require('../chunk-F6WCYCHV.js');
5
5
  var chunkTXVGYIO6_js = require('../chunk-TXVGYIO6.js');
6
6
  var chunk5KFSMXI4_js = require('../chunk-5KFSMXI4.js');
@@ -11,19 +11,19 @@ var pptx = require('ooxml-ui/pptx');
11
11
 
12
12
  Object.defineProperty(exports, "CollaborationStatusIndicator", {
13
13
  enumerable: true,
14
- get: function () { return chunkQIETGQJD_js.CollaborationStatusIndicator; }
14
+ get: function () { return chunkJSVQTF3Z_js.CollaborationStatusIndicator; }
15
15
  });
16
16
  Object.defineProperty(exports, "PowerPointViewer", {
17
17
  enumerable: true,
18
- get: function () { return chunkQIETGQJD_js.PowerPointViewer; }
18
+ get: function () { return chunkJSVQTF3Z_js.PowerPointViewer; }
19
19
  });
20
20
  Object.defineProperty(exports, "PptxI18nProvider", {
21
21
  enumerable: true,
22
- get: function () { return chunkQIETGQJD_js.PptxI18nProvider; }
22
+ get: function () { return chunkJSVQTF3Z_js.PptxI18nProvider; }
23
23
  });
24
24
  Object.defineProperty(exports, "UserAvatarBar", {
25
25
  enumerable: true,
26
- get: function () { return chunkQIETGQJD_js.UserAvatarBar; }
26
+ get: function () { return chunkJSVQTF3Z_js.UserAvatarBar; }
27
27
  });
28
28
  Object.defineProperty(exports, "CollaborationProvider", {
29
29
  enumerable: true,
Binary file
Binary file
@@ -1,4 +1,4 @@
1
- export { CollaborationStatusIndicator, PowerPointViewer, PptxI18nProvider, UserAvatarBar } from '../chunk-WLTJX2JE.mjs';
1
+ export { CollaborationStatusIndicator, PowerPointViewer, PptxI18nProvider, UserAvatarBar } from '../chunk-ELMWZISD.mjs';
2
2
  import '../chunk-NE5JQMED.mjs';
3
3
  export { CollaborationProvider, RemoteUserCursors, clearAudienceContent, isAudienceTab, loadAudienceContent, parseAudienceNonce, storeAudienceContent, useCollaborativeHistory, useCollaborativeState, usePresenceTracking, useThemeSwitching, useYjsProvider } from '../chunk-FYQVCABH.mjs';
4
4
  export { getAnimationInitialStyle } from '../chunk-MR3ZSEHS.mjs';
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-react-viewer",
3
- "version": "4.62.0",
3
+ "version": "4.62.2",
4
4
  "description": "pptx-viewer for React: a PowerPoint viewer and editor component to render, edit, and export PPTX slides in the browser.",
5
5
  "keywords": [
6
6
  "editor",
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "files": [
33
33
  "dist/",
34
+ "src/styles/theme.css",
34
35
  "CHANGELOG.md",
35
36
  "LICENSE",
36
37
  "NOTICE",
@@ -124,14 +125,14 @@
124
125
  "dependencies": {
125
126
  "clsx": "^2.1.1",
126
127
  "dompurify": "^3.4.17",
127
- "html2canvas-pro": "^2.5.2",
128
- "ooxml-core": "^1.37.0",
129
- "ooxml-ui": "^1.39.0",
128
+ "html2canvas-pro": "^2.5.4",
129
+ "ooxml-core": "^1.37.1",
130
+ "ooxml-ui": "^1.39.2",
130
131
  "opentype.js": "^2.0.0",
131
132
  "tailwind-merge": "^3.7.0"
132
133
  },
133
134
  "devDependencies": {
134
- "@ai-sdk/react": "^4.0.154",
135
+ "@ai-sdk/react": "^4.0.161",
135
136
  "@tailwindcss/cli": "^4.3.3",
136
137
  "@types/dompurify": "^3.2.0",
137
138
  "@types/opentype.js": "^1.3.10",
@@ -140,7 +141,7 @@
140
141
  "esbuild": "^0.28.2",
141
142
  "pptx-viewer-core": "^4.13.5",
142
143
  "tailwindcss": "^4.3.3",
143
- "tsdown": "^0.23.1",
144
+ "tsdown": "^0.23.4",
144
145
  "tsup": "^9.0.0",
145
146
  "typescript": "^7.0.2",
146
147
  "vitest": "^5.0.5",
@@ -0,0 +1,205 @@
1
+ /*
2
+ * pptx-viewer: theme tokens
3
+ *
4
+ * Reusable @theme block that maps Tailwind semantic color tokens to --pptx-*
5
+ * CSS custom properties. Import this file into any Tailwind v4 entry-point
6
+ * that renders <PowerPointViewer>.
7
+ *
8
+ * @import "pptx-viewer/theme.css"; // from published package
9
+ * @import "../packages/react/src/styles/theme.css"; // from monorepo
10
+ *
11
+ * All colours follow shared Office tokens when the --pptx-* properties
12
+ * are not set. Override them via the `theme` prop on the component or by
13
+ * setting the custom properties in your own CSS.
14
+ */
15
+
16
+ @theme inline {
17
+ /* ── Semantic colors ─────────────────────────────────────────────── */
18
+ --color-background: var(--pptx-background, var(--office-background, #ffffff));
19
+ --color-foreground: var(--pptx-foreground, var(--office-foreground, #1f2937));
20
+
21
+ --color-card: var(--pptx-card, var(--office-surface, #f3f4f6));
22
+ --color-card-foreground: var(--pptx-card-foreground, var(--office-foreground, #1f2937));
23
+
24
+ --color-popover: var(--pptx-popover, var(--office-popover, var(--office-background, #ffffff)));
25
+ --color-popover-foreground: var(
26
+ --pptx-popover-foreground,
27
+ var(--office-popover-foreground, var(--office-foreground, #1f2937))
28
+ );
29
+
30
+ --color-primary: var(--pptx-primary, var(--office-accent, #2563eb));
31
+ --color-primary-foreground: var(
32
+ --pptx-primary-foreground,
33
+ var(--office-accent-foreground, #ffffff)
34
+ );
35
+
36
+ --color-secondary: var(--pptx-secondary, var(--office-surface, #f3f4f6));
37
+ --color-secondary-foreground: var(--pptx-secondary-foreground, var(--office-foreground, #1f2937));
38
+
39
+ --color-muted: var(--pptx-muted, var(--office-surface, #f3f4f6));
40
+ --color-muted-foreground: var(--pptx-muted-foreground, var(--office-muted-foreground, #6b7280));
41
+
42
+ --color-accent: var(--pptx-accent, var(--office-selected, #e5e7eb));
43
+ --color-accent-foreground: var(--pptx-accent-foreground, var(--office-foreground, #1f2937));
44
+
45
+ --color-destructive: var(--pptx-destructive, var(--office-danger, #b91c1c));
46
+ --color-destructive-foreground: var(
47
+ --pptx-destructive-foreground,
48
+ var(--office-danger-foreground, #ffffff)
49
+ );
50
+
51
+ --color-border: var(--pptx-border, var(--office-border, #d1d5db));
52
+ --color-input: var(--pptx-input, var(--office-border, #d1d5db));
53
+ --color-ring: var(--pptx-ring, var(--office-ring, #2563eb));
54
+
55
+ /* ── Radius ──────────────────────────────────────────────────────── */
56
+ --radius-sm: calc(var(--pptx-radius, var(--office-radius, 4px)) - 4px);
57
+ --radius-md: calc(var(--pptx-radius, var(--office-radius, 4px)) - 2px);
58
+ --radius-lg: var(--pptx-radius, var(--office-radius, 4px));
59
+ --radius-xl: calc(var(--pptx-radius, var(--office-radius, 4px)) + 4px);
60
+ }
61
+
62
+ /* ── Reduced motion ──────────────────────────────────────────────────
63
+ * When the OS prefers-reduced-motion OR the user manually enables it
64
+ * via the .pptx-reduced-motion class, disable all CSS animations and
65
+ * transitions throughout the viewer.
66
+ */
67
+ @media (prefers-reduced-motion: reduce) {
68
+ [data-pptx-viewer] *,
69
+ [data-pptx-viewer] *::before,
70
+ [data-pptx-viewer] *::after {
71
+ animation-duration: 0.01ms !important;
72
+ animation-iteration-count: 1 !important;
73
+ transition-duration: 0.01ms !important;
74
+ scroll-behavior: auto !important;
75
+ }
76
+ }
77
+
78
+ .pptx-reduced-motion *,
79
+ .pptx-reduced-motion *::before,
80
+ .pptx-reduced-motion *::after {
81
+ animation-duration: 0.01ms !important;
82
+ animation-iteration-count: 1 !important;
83
+ transition-duration: 0.01ms !important;
84
+ scroll-behavior: auto !important;
85
+ }
86
+
87
+ /* ── Text autosizing. Slide text is laid out against fixed PowerPoint canvas
88
+ * geometry and the viewer scales the whole slide as one unit. Mobile browsers
89
+ * (and responsive iframes) may otherwise inflate only the glyphs, which
90
+ * changes line wrapping and clips text even though the deck is correct.
91
+ */
92
+ [data-pptx-viewer] {
93
+ font-family: var(--pptx-font, var(--office-font, system-ui, sans-serif));
94
+ -webkit-text-size-adjust: none;
95
+ text-size-adjust: none;
96
+ }
97
+
98
+ /* ── Hardware acceleration (Options > Advanced > "Disable hardware
99
+ * graphics acceleration"). Strips the GPU-compositing hints (will-change,
100
+ * backface-visibility, perspective) transitions/3D effects rely on, for
101
+ * users on underpowered/unstable graphics drivers. See
102
+ * `resolveOptionRootClasses` in pptx-viewer-shared.
103
+ */
104
+ [data-pptx-viewer].pptx-no-hw-accel *,
105
+ [data-pptx-viewer].pptx-no-hw-accel *::before,
106
+ [data-pptx-viewer].pptx-no-hw-accel *::after {
107
+ will-change: auto !important;
108
+ backface-visibility: visible !important;
109
+ perspective: none !important;
110
+ }
111
+
112
+ /* ── Display optimization (Options > General > "Optimize for compatibility")
113
+ * Drops shadow/blur/blend-mode effects across the viewer, mirroring
114
+ * PowerPoint's own degraded-effects mode for older/weaker hardware. See
115
+ * `resolveOptionRootClasses` in pptx-viewer-shared.
116
+ */
117
+ [data-pptx-viewer].pptx-compat-display *,
118
+ [data-pptx-viewer].pptx-compat-display *::before,
119
+ [data-pptx-viewer].pptx-compat-display *::after {
120
+ box-shadow: none !important;
121
+ backdrop-filter: none !important;
122
+ -webkit-backdrop-filter: none !important;
123
+ mix-blend-mode: normal !important;
124
+ }
125
+
126
+ /* ── Custom scrollbar styling ───────────────────────────────────────
127
+ * Thin, subtle scrollbars that match the dark theme. Uses both the
128
+ * WebKit pseudo-elements and the standard scrollbar-* properties.
129
+ */
130
+ :where([data-pptx-viewer]) {
131
+ scrollbar-width: thin;
132
+ scrollbar-color: var(--pptx-border, var(--office-border, #d1d5db)) transparent;
133
+ }
134
+
135
+ :where([data-pptx-viewer]) ::-webkit-scrollbar {
136
+ width: 6px;
137
+ height: 6px;
138
+ }
139
+
140
+ :where([data-pptx-viewer]) ::-webkit-scrollbar-track {
141
+ background: transparent;
142
+ }
143
+
144
+ :where([data-pptx-viewer]) ::-webkit-scrollbar-thumb {
145
+ background-color: var(--pptx-border, var(--office-border, #d1d5db));
146
+ border-radius: 3px;
147
+ }
148
+
149
+ :where([data-pptx-viewer]) ::-webkit-scrollbar-thumb:hover {
150
+ background-color: var(--pptx-muted-foreground, var(--office-muted-foreground, #6b7280));
151
+ }
152
+
153
+ :where([data-pptx-viewer]) ::-webkit-scrollbar-corner {
154
+ background: transparent;
155
+ }
156
+
157
+ /* ── Button press feedback ──────────────────────────────────────────
158
+ * Subtle scale-down on press for all interactive elements in the
159
+ * toolbar and status bar areas.
160
+ */
161
+ [data-pptx-viewer] [role='toolbar'] button,
162
+ [data-pptx-viewer] [role='toolbar'] [role='button'] {
163
+ transition:
164
+ transform 0.1s ease,
165
+ opacity 0.1s ease;
166
+ }
167
+
168
+ /* ── Focus indicators ────────────────────────────────────────────────
169
+ * Ensure keyboard focus is visible on interactive slide elements.
170
+ */
171
+ [data-pptx-element]:focus-visible {
172
+ outline: 2px solid var(--pptx-ring, var(--office-ring, #2563eb));
173
+ outline-offset: 2px;
174
+ z-index: 999;
175
+ }
176
+
177
+ :where([data-pptx-viewer])
178
+ :where(button, a, input, select, textarea, [tabindex]):not(
179
+ [data-pptx-search-input]
180
+ ):focus-visible {
181
+ outline: 2px solid var(--pptx-ring, var(--office-ring, #2563eb)) !important;
182
+ outline-offset: 2px;
183
+ }
184
+
185
+ :where([data-pptx-viewer])
186
+ :where(button, [role='button']):where(
187
+ :not([role='switch']):not([data-pptx-compact]):not([data-pptx-backstage-nav-item])
188
+ ) {
189
+ min-width: 24px;
190
+ min-height: 24px;
191
+ touch-action: manipulation;
192
+ }
193
+
194
+ @media (forced-colors: active) {
195
+ :where([data-pptx-viewer])
196
+ :where(button, a, input, select, textarea, [tabindex]):not(
197
+ [data-pptx-search-input]
198
+ ):focus-visible {
199
+ outline-color: Highlight;
200
+ }
201
+ :where([data-pptx-viewer]) [data-pptx-search-surface]:focus-within {
202
+ outline: 2px solid Highlight;
203
+ outline-offset: 2px;
204
+ }
205
+ }
Binary file
Binary file
Binary file