pptx-react-viewer 4.50.0 → 4.51.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 (63) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +38 -4
  3. package/dist/{AiChatPanel-WYAL24DX.js → AiChatPanel-EV22O7UO.js} +19 -20
  4. package/dist/AiChatPanel-EV22O7UO.js.br +0 -0
  5. package/dist/AiChatPanel-EV22O7UO.js.gz +0 -0
  6. package/dist/{AiChatPanel-VJV5OEG2.mjs → AiChatPanel-R323KNGN.mjs} +1 -2
  7. package/dist/AiChatPanel-R323KNGN.mjs.br +0 -0
  8. package/dist/AiChatPanel-R323KNGN.mjs.gz +0 -0
  9. package/dist/{chunk-QHGEPW5G.mjs → chunk-ACFR4LFQ.mjs} +15 -18
  10. package/dist/chunk-ACFR4LFQ.mjs.br +0 -0
  11. package/dist/chunk-ACFR4LFQ.mjs.gz +0 -0
  12. package/dist/{chunk-5JJQLK7N.mjs → chunk-ETJ752B5.mjs} +151 -48
  13. package/dist/chunk-ETJ752B5.mjs.br +0 -0
  14. package/dist/chunk-ETJ752B5.mjs.gz +0 -0
  15. package/dist/{chunk-D5NXYXPP.js → chunk-V3XADJ2O.js} +213 -216
  16. package/dist/chunk-V3XADJ2O.js.br +0 -0
  17. package/dist/chunk-V3XADJ2O.js.gz +0 -0
  18. package/dist/{chunk-4OF7X5EE.js → chunk-VI5DQRQZ.js} +693 -589
  19. package/dist/chunk-VI5DQRQZ.js.br +0 -0
  20. package/dist/chunk-VI5DQRQZ.js.gz +0 -0
  21. package/dist/{chunk-JWNBTFZZ.js → chunk-Z22RD3E2.js} +41 -6
  22. package/dist/chunk-Z22RD3E2.js.br +0 -0
  23. package/dist/chunk-Z22RD3E2.js.gz +0 -0
  24. package/dist/{chunk-77IXTLKU.mjs → chunk-ZCGYPCZM.mjs} +35 -5
  25. package/dist/chunk-ZCGYPCZM.mjs.br +0 -0
  26. package/dist/chunk-ZCGYPCZM.mjs.gz +0 -0
  27. package/dist/index.d.ts +51 -12
  28. package/dist/index.js +28 -24
  29. package/dist/index.js.br +0 -0
  30. package/dist/index.js.gz +0 -0
  31. package/dist/index.mjs +3 -3
  32. package/dist/index.mjs.br +0 -0
  33. package/dist/index.mjs.gz +0 -0
  34. package/dist/internals.js +81 -81
  35. package/dist/internals.js.br +0 -0
  36. package/dist/internals.js.gz +0 -0
  37. package/dist/internals.mjs +2 -2
  38. package/dist/internals.mjs.br +0 -0
  39. package/dist/internals.mjs.gz +0 -0
  40. package/dist/viewer/index.d.ts +51 -12
  41. package/dist/viewer/index.js +23 -19
  42. package/dist/viewer/index.js.br +0 -0
  43. package/dist/viewer/index.js.gz +0 -0
  44. package/dist/viewer/index.mjs +3 -3
  45. package/dist/viewer/index.mjs.br +0 -0
  46. package/dist/viewer/index.mjs.gz +0 -0
  47. package/package.json +3 -3
  48. package/dist/AiChatPanel-VJV5OEG2.mjs.br +0 -0
  49. package/dist/AiChatPanel-VJV5OEG2.mjs.gz +0 -0
  50. package/dist/AiChatPanel-WYAL24DX.js.br +0 -0
  51. package/dist/AiChatPanel-WYAL24DX.js.gz +0 -0
  52. package/dist/chunk-4OF7X5EE.js.br +0 -0
  53. package/dist/chunk-4OF7X5EE.js.gz +0 -0
  54. package/dist/chunk-5JJQLK7N.mjs.br +0 -0
  55. package/dist/chunk-5JJQLK7N.mjs.gz +0 -0
  56. package/dist/chunk-77IXTLKU.mjs.br +0 -0
  57. package/dist/chunk-77IXTLKU.mjs.gz +0 -0
  58. package/dist/chunk-D5NXYXPP.js.br +0 -0
  59. package/dist/chunk-D5NXYXPP.js.gz +0 -0
  60. package/dist/chunk-JWNBTFZZ.js.br +0 -0
  61. package/dist/chunk-JWNBTFZZ.js.gz +0 -0
  62. package/dist/chunk-QHGEPW5G.mjs.br +0 -0
  63. package/dist/chunk-QHGEPW5G.mjs.gz +0 -0
Binary file
Binary file
@@ -1,20 +1,50 @@
1
1
  'use strict';
2
2
 
3
+ var i18n = require('ooxml-ui/pptx/i18n');
4
+ var React8 = require('react');
5
+ var reactI18next = require('react-i18next');
3
6
  var pptx = require('ooxml-ui/pptx');
4
7
  var clsx = require('clsx');
5
8
  var tailwindMerge = require('tailwind-merge');
6
- var React8 = require('react');
7
9
  var lu = require('react-icons/lu');
8
10
  var pptx$1 = require('ooxml-core/pptx');
9
11
  var jsxRuntime = require('react/jsx-runtime');
10
- var i18n = require('ooxml-ui/pptx/i18n');
11
- var reactI18next = require('react-i18next');
12
12
 
13
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
14
 
15
15
  var React8__default = /*#__PURE__*/_interopDefault(React8);
16
16
 
17
- // src/viewer/utils/animation-effects.ts
17
+ // src/viewer/i18n/use-translation.ts
18
+ var ViewerI18nContext = /* @__PURE__ */ React8.createContext(null);
19
+ var PptxI18nContext = /* @__PURE__ */ React8.createContext(null);
20
+ var NO_LOCALE_CONTROLS = {
21
+ localeCode: "en",
22
+ locales: [],
23
+ selectLocale: () => {
24
+ },
25
+ languageSelectable: true
26
+ };
27
+ var ViewerLocaleControlsContext = /* @__PURE__ */ React8.createContext(NO_LOCALE_CONTROLS);
28
+ function useHostI18next() {
29
+ const { t, i18n } = reactI18next.useTranslation();
30
+ return { t, i18n };
31
+ }
32
+
33
+ // src/viewer/i18n/use-translation.ts
34
+ var LABELS_ONLY = { t: (key) => i18n.keyToLabel(key), locale: "en" };
35
+ function useHostTranslation() {
36
+ const { t, i18n } = useHostI18next();
37
+ const language = i18n.resolvedLanguage ?? i18n.language ?? "en";
38
+ return React8.useMemo(() => ({ t, locale: language }), [t, language]);
39
+ }
40
+ function useTranslation() {
41
+ const fromRoot = React8.useContext(ViewerI18nContext);
42
+ const provided = React8.useContext(PptxI18nContext);
43
+ const resolved = fromRoot ?? provided;
44
+ const [readsHost] = React8.useState(resolved === null);
45
+ const host = readsHost ? useHostTranslation() : null;
46
+ return resolved ?? host ?? LABELS_ONLY;
47
+ }
18
48
  function getAnimationInitialStyle(preset, nativeAnimation) {
19
49
  return pptx.getAnimationInitialStyle(preset, nativeAnimation);
20
50
  }
@@ -447,7 +477,7 @@ function PresentationMediaController({
447
477
  onPlayStateChange,
448
478
  children
449
479
  }) {
450
- const { t } = reactI18next.useTranslation();
480
+ const { t } = useTranslation();
451
481
  const mediaRef = React8.useRef(null);
452
482
  const [isMediaPlaying, setIsMediaPlaying] = React8.useState(false);
453
483
  const trimStartSec = element.trimStartMs !== void 0 ? element.trimStartMs / 1e3 : 0;
@@ -1328,7 +1358,7 @@ function renderHyperlink(run, spanNode, key, ctx) {
1328
1358
  );
1329
1359
  }
1330
1360
  function FollowLinkHint() {
1331
- const { t } = reactI18next.useTranslation();
1361
+ const { t } = useTranslation();
1332
1362
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: t("pptx.linkTooltip.followLink") });
1333
1363
  }
1334
1364
  function wrapWithTextReflection(run, key, spanNode, spanStyle, baseContent) {
@@ -4210,11 +4240,14 @@ exports.DEFAULT_TEXT_FONT_SIZE = DEFAULT_TEXT_FONT_SIZE;
4210
4240
  exports.GRID_SIZE = GRID_SIZE;
4211
4241
  exports.HYPERLINK_COLOR = HYPERLINK_COLOR;
4212
4242
  exports.MIN_ELEMENT_SIZE = MIN_ELEMENT_SIZE;
4243
+ exports.PptxI18nContext = PptxI18nContext;
4213
4244
  exports.SHAPE_PRESETS = SHAPE_PRESETS;
4214
4245
  exports.SHORTCUT_REFERENCE_ITEMS = SHORTCUT_REFERENCE_ITEMS;
4215
4246
  exports.SLIDE_NAV_THUMBNAIL_WIDTH = SLIDE_NAV_THUMBNAIL_WIDTH;
4216
4247
  exports.TOOLBAR_SECTIONS = TOOLBAR_SECTIONS;
4217
4248
  exports.UNGROUPED_SECTION_ID = UNGROUPED_SECTION_ID;
4249
+ exports.ViewerI18nContext = ViewerI18nContext;
4250
+ exports.ViewerLocaleControlsContext = ViewerLocaleControlsContext;
4218
4251
  exports.ZOOM_TO_SELECTION_PADDING = ZOOM_TO_SELECTION_PADDING;
4219
4252
  exports.build3DExtrusionData = build3DExtrusionData;
4220
4253
  exports.buildLineGlowFilter = buildLineGlowFilter;
@@ -4250,3 +4283,5 @@ exports.shouldRenderFallbackLabel = shouldRenderFallbackLabel;
4250
4283
  exports.startMotionPathPreview = startMotionPathPreview;
4251
4284
  exports.startPreviewAnimation = startPreviewAnimation;
4252
4285
  exports.stopPreviewAnimation = stopPreviewAnimation;
4286
+ exports.useHostI18next = useHostI18next;
4287
+ exports.useTranslation = useTranslation;
Binary file
Binary file
@@ -1,16 +1,46 @@
1
+ import { translationsEn, keyToLabel } from 'ooxml-ui/pptx/i18n';
2
+ import React8, { createContext, useContext, useState, useMemo, useRef, useEffect, useCallback, useLayoutEffect } from 'react';
3
+ import { useTranslation as useTranslation$1 } from 'react-i18next';
1
4
  import { VIEWER_SHORTCUT_REFERENCE, getAnimationInitialStyle as getAnimationInitialStyle$1, cloneHistorySnapshot as cloneHistorySnapshot$1, SHAPE_PRESET_DEFS, getImageFitStyle, getImageFillCounterTransform, getComputedFillStyle, getCropShapeClipPath as getCropShapeClipPath$1, getImageTilingStyle as getImageTilingStyle$1, mediaPlaybackAttributes, getOnlineVideoEmbed, ONLINE_VIDEO_IFRAME_SANDBOX, ONLINE_VIDEO_IFRAME_ALLOW, buildTextBlockStyle, toCssWritingMode, toCssTextOrientation, toCssVerticalDirection, buildTextBodyLayoutStyle, buildTextBody3DSceneStyle as buildTextBody3DSceneStyle$1, buildParagraphs, followingText, colorWithOpacity, normalizeHexColor, hexToRgbUnit, build3DExtrusionData as build3DExtrusionData$1, getFrameEffectStyle, getComputedEffectStyle, getComputedStrokeStyle, getAnimationColorBaseStyle, isStrokeOnlyPresetElement, resolveShapeGeometry, screenStrokeWidth, markerPath, normalizeStrokeDashType, getSvgStrokeDasharray, buildSvgGradientDef, isArrowedCustomPath, buildStrokeOutline, getPresetShapeVectorGeometry, isWedgeCalloutPresetShape, svgGradientFillRef, svgLineCap, getCompoundLineOffsets, getCompoundLineWidths, canDrillDown, computeSelectionRect, DEFAULT_FONT_FAMILY as DEFAULT_FONT_FAMILY$1, cellStyleToCss, TABLE_CELL_TEXT_DEFAULTS, applyTableCellFontWeight, rectToCells, isCellInRect, tableContainerCss, buildChartViewModel, resolveChartKind, chartPreserveAspectRatio, buildNotesPdfBytes, buildTiledSlidesPdfBytes, buildPreviewAnimation, measurePreviewGeometry, buildMotionPathPreview, mediaFallbackVisual, scheduleMediaTrimAndFade, registerCrossSlideAudio, shouldShowMediaFullscreenStopButton, withInlineListDecorationDefaults, segmentStyleToCss, resolveAutoFitFontScale, applyUnderlineVariant, nestedTextDecorationStyle, scaleFontSizeForAutoFit, resolveFontKerning, resolveScriptFontSet, hasDistinctScriptFonts, authoredLetterSpacingPx, eastAsianBreaksForRun, pieceLetterSpacing, resolveMetricTrackingPx, hollowTextFillStyle, splitsUnderlineIntoWords, stripUnderlineDecoration, buildTabContext, TEXT_BUILD_ID_SEP, buildTextBuildSpec, textBuildSpanStyle, apply3dEffects as apply3dEffects$1, buildSubpathPaints, computeColumnBoundaries, computeTableMergeCrossings, columnHandleSegments, rowHandleSegments, getTableCellBandStyle as getTableCellBandStyle$1, parseDrawingColor, parseDrawingColorOpacity, getCellDiagonalBorders as getCellDiagonalBorders$1, cellParagraphBlocks, resolveChartPalette, computeChartLegendLayout, resolveChartSvgDef, mediaFallbackIcon, mediaFallbackLabelKey, MEDIA_CHROME_ATTRIBUTE, convertOmmlToMathMl, sanitizeMathMl, tableCellCss, computeResizedColumnWidths, computeResizedRowHeight, DEFAULT_ROW_HEIGHT, buildRectPathGradient, screenBorder, cellRunStyle, buildRunTabLines, chartPartToAttrs, splitWordsForUnderline, splitRunForMetrics, splitEastAsianBreaks, splitRunByScriptFont } from 'ooxml-ui/pptx';
2
5
  export { ACTION_BUTTON_PRESETS, DEFAULT_COLOR_CHANGE_TOLERANCE, INK_REPLAY_KEYFRAMES, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, SLIDE_TRANSITION_OPTIONS, TABLE_STYLE_PRESETS, applyColorChange, applyFormatToElement, applyReroutedConnectors, buildCacheKey, buildContentPartStrokes, buildCssGradientFromShapeStyle, buildInkGroupStrokes, buildSaveSlides, canvasToJpegData, clampCropValue, cloneSlide, cloneTemplateElementsBySlideId, colorWithOpacity, comparePresentation, computeHandoutLayout, copyFormatFromElement, formatCommentTimestamp, generateNoteLineCount, getAriaLabel, getAriaRole, getAriaRoleDescription, getCachedResult, getCompoundLineOffsets, getCompoundLineWidths, getContentPartReplayStyles, getElementLabel, getElementTransform, getElementTransformWithoutRotation, getImageEffectsFilter, getImageEffectsOpacity, getInkReplayStyles, getPatternSvg, getPrintableArea, getShapeAdjustmentHandleDescriptors, getSvgStrokeDasharray, getTextCompensationTransform, hasCopyableFormat, isEditableTextElement, isImageTiled, isPpactionUrl, isTemplateElementId, isUrlSafe, makeCloneId, mergeCells, normalizeHexColor, normalizeStrokeDashType, openNativeEyeDropper, parsePpactionUrl, partitionTemplateElements, rerouteConnectorsForMovedElements, safeOpenUrl, sanitizeGradientStops, setCachedResult, splitCell, stopAllPersistentAudio, substituteFieldText } from 'ooxml-ui/pptx';
3
6
  import { clsx } from 'clsx';
4
7
  import { twMerge } from 'tailwind-merge';
5
- import React8, { useRef, useState, useEffect, useCallback, useMemo, useLayoutEffect } from 'react';
6
8
  import { LuTriangle, LuPlus, LuMoveRight, LuMinus, LuDiamond, LuDatabase, LuCircle, LuSquare } from 'react-icons/lu';
7
9
  import { hasShapeProperties, isImageLikeElement, hasTextProperties, getConnectorPathGeometry as getConnectorPathGeometry$1, isCalloutShape, getCalloutLeaderLineGeometry, buildCalloutLeaderLineSvgPath, getCalloutViewBoxBounds, getSubstituteFontFamily, parsePanoseString, customGeometryPathsToSvgSubpaths, xmlText, ooxmlGradientAngleToCssDegrees } from 'ooxml-core/pptx';
8
10
  export { updateCellTextInRawXml, updateCellTextStyleInRawXml, updateMergeAttrsInRawXml } from 'ooxml-core/pptx';
9
11
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
- import { translationsEn } from 'ooxml-ui/pptx/i18n';
11
- import { useTranslation } from 'react-i18next';
12
12
 
13
- // src/viewer/utils/animation-effects.ts
13
+ // src/viewer/i18n/use-translation.ts
14
+ var ViewerI18nContext = /* @__PURE__ */ createContext(null);
15
+ var PptxI18nContext = /* @__PURE__ */ createContext(null);
16
+ var NO_LOCALE_CONTROLS = {
17
+ localeCode: "en",
18
+ locales: [],
19
+ selectLocale: () => {
20
+ },
21
+ languageSelectable: true
22
+ };
23
+ var ViewerLocaleControlsContext = /* @__PURE__ */ createContext(NO_LOCALE_CONTROLS);
24
+ function useHostI18next() {
25
+ const { t, i18n } = useTranslation$1();
26
+ return { t, i18n };
27
+ }
28
+
29
+ // src/viewer/i18n/use-translation.ts
30
+ var LABELS_ONLY = { t: (key) => keyToLabel(key), locale: "en" };
31
+ function useHostTranslation() {
32
+ const { t, i18n } = useHostI18next();
33
+ const language = i18n.resolvedLanguage ?? i18n.language ?? "en";
34
+ return useMemo(() => ({ t, locale: language }), [t, language]);
35
+ }
36
+ function useTranslation() {
37
+ const fromRoot = useContext(ViewerI18nContext);
38
+ const provided = useContext(PptxI18nContext);
39
+ const resolved = fromRoot ?? provided;
40
+ const [readsHost] = useState(resolved === null);
41
+ const host = readsHost ? useHostTranslation() : null;
42
+ return resolved ?? host ?? LABELS_ONLY;
43
+ }
14
44
  function getAnimationInitialStyle(preset, nativeAnimation) {
15
45
  return getAnimationInitialStyle$1(preset, nativeAnimation);
16
46
  }
@@ -3926,4 +3956,4 @@ function stopPreviewAnimation() {
3926
3956
  activePreview = null;
3927
3957
  }
3928
3958
 
3929
- export { ANIMATION_PRESET_OPTIONS, ARROW_SIZE_OPTIONS, CONNECTOR_ARROW_OPTIONS, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_FILL_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_SECTION_GROUP_ID, DEFAULT_STROKE_COLOR, DEFAULT_TABLE_COLUMNS, DEFAULT_TABLE_ROWS, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_FONT_SIZE, GRID_SIZE, HYPERLINK_COLOR, MIN_ELEMENT_SIZE, SHAPE_PRESETS, SHORTCUT_REFERENCE_ITEMS, SLIDE_NAV_THUMBNAIL_WIDTH, TOOLBAR_SECTIONS, UNGROUPED_SECTION_ID, ZOOM_TO_SELECTION_PADDING, build3DExtrusionData, buildLineGlowFilter, buildLineShadowCss, buildNotesPdf, buildPdfFromTiledImageData, buildReactChartViewModel, buildTextBody3DSceneStyle, cloneHistorySnapshot, cn, getAnimationInitialStyle, getConnectorPathGeometry, getCropShapeClipPath, getDuotoneColors, getImageRenderStyle, getImageSurfaceMaskStyle, getImageSurfaceStyle, getImageTilingStyle, getShapeVisualStyle, getTextLayoutStyle, getTextStyleForElement, getTextWarpStyle, hasDagDuotoneEffect, isConnectorOrLineElement, renderChartElement, renderConnectorMarker, renderDagDuotoneSvgFilter, renderMediaElement, renderTableElement, renderTextSegments, renderVectorShape, shouldRenderFallbackLabel, startMotionPathPreview, startPreviewAnimation, stopPreviewAnimation };
3959
+ export { ANIMATION_PRESET_OPTIONS, ARROW_SIZE_OPTIONS, CONNECTOR_ARROW_OPTIONS, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_FILL_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_SECTION_GROUP_ID, DEFAULT_STROKE_COLOR, DEFAULT_TABLE_COLUMNS, DEFAULT_TABLE_ROWS, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_FONT_SIZE, GRID_SIZE, HYPERLINK_COLOR, MIN_ELEMENT_SIZE, PptxI18nContext, SHAPE_PRESETS, SHORTCUT_REFERENCE_ITEMS, SLIDE_NAV_THUMBNAIL_WIDTH, TOOLBAR_SECTIONS, UNGROUPED_SECTION_ID, ViewerI18nContext, ViewerLocaleControlsContext, ZOOM_TO_SELECTION_PADDING, build3DExtrusionData, buildLineGlowFilter, buildLineShadowCss, buildNotesPdf, buildPdfFromTiledImageData, buildReactChartViewModel, buildTextBody3DSceneStyle, cloneHistorySnapshot, cn, getAnimationInitialStyle, getConnectorPathGeometry, getCropShapeClipPath, getDuotoneColors, getImageRenderStyle, getImageSurfaceMaskStyle, getImageSurfaceStyle, getImageTilingStyle, getShapeVisualStyle, getTextLayoutStyle, getTextStyleForElement, getTextWarpStyle, hasDagDuotoneEffect, isConnectorOrLineElement, renderChartElement, renderConnectorMarker, renderDagDuotoneSvgFilter, renderMediaElement, renderTableElement, renderTextSegments, renderVectorShape, shouldRenderFallbackLabel, startMotionPathPreview, startPreviewAnimation, stopPreviewAnimation, useHostI18next, useTranslation };
Binary file
Binary file
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React$1 from 'react';
2
- import React$1__default from 'react';
2
+ import React$1__default, { ReactNode, ReactElement } from 'react';
3
3
  import * as ooxml_ui_pptx from 'ooxml-ui/pptx';
4
4
  import { CollaborationRole, CollaborationConfig, ViewportFitOptions, ViewerFontSource, CanvasSize, DocumentStorage, ViewerAutosaveStatus, AutosaveRecord, ConnectionStatus, ViewerTheme, ThemeCatalogEntry, AccountAuthConfig, CollaborationInput, ToolbarActionId, RibbonAddInTab, ViewerCustomization, PowerPointViewerAPI, ViewerCustomizationApi, CollaborationLivePatcher, InlineListReadResult, EditorImagePasteOptions, ViewerMode, RulerUnit, ElementAnimationState, ShapeAdjustmentHandleDescriptor, InlineTextEditSnapshot, ZoomNavigationTarget, FieldSubstitutionContext, EditPointsCommandId, EditPointsElementPatch, FreeformToolKind, ElementClipboardPayload, AnimationApplyGroup, InsertChartKind, ChangeCaseMode, SlideTemplateId, ReviewCommentsHost, CollaborationShellState, PptxAutosaveStatus } from 'ooxml-ui/pptx';
5
5
  export { AVATAR_COLOR_SWATCHES, AccountAuthConfig, BACKSTAGE_CARD_IDS, BACKSTAGE_PAGE_IDS, BackstageCustomization, CANVAS_CONTEXT_MENU_COMMAND_IDS, CollaborationConfig, CollaborationShellState, ContextMenuCustomization, DEFAULT_VIEWER_PROFILE, EDITOR_SHORTCUT_ACTION_IDS, ELEMENT_CONTEXT_MENU_COMMAND_IDS, ElementUpdate, ElementUpdateOptions, ExternalCollaborationAwareness, ExternalCollaborationSession, ExternalCollaborationSnapshot, HostCanvasMenuContext, HostElementMenuContext, HostMenuCommand, KeyboardCustomization, LocalStorageUsageSummary, OPTIONS_PAGE_IDS, OPTIONS_SECTION_IDS, OPTIONS_SETTING_IDS, OptionsCustomization, OptionsPageId, OptionsSectionId, OptionsSettingId, OptionsSettingValues, PPTX_OPEN_ACCEPT, PRESENTATION_OPEN_EXTENSIONS, PowerPointViewerAPI, RIBBON_TAB_IDS, ResolvedCustomization, RibbonCustomization, SLIDE_TEMPLATES, SavedPresentationFormat, ShortcutChord, SlideTemplateId, SlideTemplateSpec, StoredViewerPrefs, THEME_CATALOG, TOOLBAR_BUTTON_IDS, ThemeCatalogEntry, ToolbarActionId, ToolbarButtonId, ToolbarTabId, VIEWER_DIALOG_IDS, VIEWER_EXPORT_FORMAT_IDS, VIEWER_FEATURE_IDS, VIEWER_PANEL_IDS, VIEWER_PREFS_STORAGE_KEY, ViewerCustomization, ViewerCustomizationApi, ViewerDialogId, ViewerExportFormatId, ViewerFeatureId, ViewerMode, ViewerPanelId, ViewerProfile, ViewerTheme, ViewerThemeColors, ViewportFitOptions, ViewportFitPadding, buildSlideTemplateContent, buildSlideTemplateSlide, clearAllLocalViewerData, clearStoredViewerPrefs, createImageElementFromFile, defaultCssVars, defaultRadius, defaultThemeColors, describeCollaborationShellState, getLocalStorageUsageSummary, isLegacyBinaryPresentation, isSupportedPresentationFile, presentationBaseName, readStoredViewerPrefs, resolveProfileInitial, resolveThemeCatalogEntry, saveViewerProfile, savedPresentationFileName, themeToCssVars, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius, writeStoredViewerPrefs } from 'ooxml-ui/pptx';
@@ -302,21 +302,21 @@ interface PowerPointViewerProps extends ViewportFitOptions {
302
302
  */
303
303
  onThemeChange?: (key: string) => void;
304
304
  /**
305
- * Initial locale code for File > Options > Language. Falls back to a
306
- * persisted `localStorage` choice, then `'en'`.
305
+ * Initial locale code for File > Options > Language. Falls back to a persisted `localStorage`
306
+ * choice, then `'en'`. Ignored inside a `PptxI18nProvider`, whose `locale` is the language.
307
307
  */
308
308
  defaultLocale?: string;
309
309
  /**
310
- * Locale choices offered by File > Options > Language. Defaults to the
311
- * codes actually registered on the host's `react-i18next` instance
312
- * (mapped through the shared `LOCALE_CATALOG` for display labels).
310
+ * Locale choices offered by File > Options > Language. Defaults to the codes registered on the
311
+ * host's `react-i18next` instance. Inside a `PptxI18nProvider` there is no default: pass two or
312
+ * more, together with `onLocaleChange`, to show the Language category.
313
313
  */
314
314
  availableLocales?: LocaleCatalogEntry[];
315
315
  /**
316
- * Called when the user picks a language from File > Options > Language.
317
- * When provided, the host owns applying and persisting the choice (the
318
- * viewer will not call `i18n.changeLanguage` or touch `localStorage`
319
- * itself); otherwise the viewer applies and persists it directly.
316
+ * Called when the user picks a language from File > Options > Language. When provided, the
317
+ * host owns applying and persisting the choice; otherwise the viewer applies and persists it
318
+ * itself. Inside a `PptxI18nProvider` the host always owns the language: without this callback
319
+ * the Language category is left out.
320
320
  */
321
321
  onLocaleChange?: (code: string) => void;
322
322
  /**
@@ -546,6 +546,45 @@ declare function getAnimationInitialStyle(preset: PptxAnimationPreset | undefine
546
546
  * access (e.g. serialising the current content for saving).
547
547
  */
548
548
  declare const PowerPointViewer: React$1.ForwardRefExoticComponent<PowerPointViewerProps & React$1.RefAttributes<PowerPointViewerHandle>>;
549
+ //#endregion
550
+ //#region src/viewer/i18n/types.d.ts
551
+ /** What the viewer passes `translate`: exactly the params of the call. */
552
+ interface PptxTranslateParams {
553
+ readonly defaultValue?: string;
554
+ readonly count?: number;
555
+ readonly [name: string]: unknown;
556
+ }
557
+ /**
558
+ * A host translator for {@link PptxI18nProvider}: the text for a viewer key (`pptx.*`) in the
559
+ * host's active language. Return the key itself, an empty string, `null` or `undefined` for "no
560
+ * translation": the viewer then shows its built-in English text.
561
+ */
562
+ type PptxTranslate = (key: string, params?: PptxTranslateParams) => string | null | undefined;
563
+ //#endregion
564
+ //#region src/viewer/i18n/provider.d.ts
565
+ interface PptxI18nProviderProps {
566
+ /**
567
+ * Translates a viewer key; see {@link PptxTranslate}. Keep it referentially stable (a
568
+ * module-level function or `useCallback`): the viewer re-translates, re-rendering and re-running
569
+ * every translated effect, whenever `translate` or `locale` changes. To pick up messages loaded
570
+ * later for the same language, pass a new function.
571
+ */
572
+ readonly translate: PptxTranslate;
573
+ /**
574
+ * The host's active language: what the viewer reports and File > Options > Language shows as
575
+ * selected. A change re-translates the viewer, also when `translate` stays the same.
576
+ */
577
+ readonly locale: string;
578
+ readonly children?: ReactNode;
579
+ }
580
+ /**
581
+ * Translates every viewer component below it (`PowerPointViewer` and the standalone building
582
+ * blocks) through the host's own i18n library instead of react-i18next. A `PowerPointViewer`
583
+ * reads the provider nearest above it; a provider rendered inside the viewer is ignored, so the
584
+ * whole viewer shares one language. React only: the other bindings translate through their
585
+ * framework's i18n library or a `messages` dictionary.
586
+ */
587
+ declare function PptxI18nProvider({ translate, locale, children }: PptxI18nProviderProps): ReactElement;
549
588
 
550
589
  //#region src/viewer/components/toolbar/toolbar-types.d.ts
551
590
  interface ToolbarProps {
@@ -1117,5 +1156,5 @@ declare function SlideTemplatePreview({ templateId, scheme }: SlideTemplatePrevi
1117
1156
  */
1118
1157
  declare function renderToCanvas(element: HTMLElement, options?: Partial<Options>): Promise<HTMLCanvasElement>;
1119
1158
 
1120
- export { PowerPointViewer, SlideCanvas, SlideTemplateGalleryDialog, SlideTemplatePreview, Toolbar, ViewerThemeProvider, getAnimationInitialStyle, renderToCanvas, useViewerBuildingBlocks, useViewerTheme };
1121
- export type { CollaborationContextValue, PowerPointViewerHandle, PowerPointViewerProps, SlideCanvasProps, SlideTemplateGalleryDialogProps, SlideTemplatePreviewProps, ToolbarProps, UseViewerBuildingBlocksInput, ViewerBuildingBlocksResult, ViewerLoadDetail };
1159
+ export { PowerPointViewer, PptxI18nProvider, SlideCanvas, SlideTemplateGalleryDialog, SlideTemplatePreview, Toolbar, ViewerThemeProvider, getAnimationInitialStyle, renderToCanvas, useViewerBuildingBlocks, useViewerTheme };
1160
+ export type { CollaborationContextValue, PowerPointViewerHandle, PowerPointViewerProps, PptxI18nProviderProps, PptxTranslate, PptxTranslateParams, SlideCanvasProps, SlideTemplateGalleryDialogProps, SlideTemplatePreviewProps, ToolbarProps, UseViewerBuildingBlocksInput, ViewerBuildingBlocksResult, ViewerLoadDetail };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk4OF7X5EE_js = require('./chunk-4OF7X5EE.js');
4
- var chunkD5NXYXPP_js = require('./chunk-D5NXYXPP.js');
5
- var chunkJWNBTFZZ_js = require('./chunk-JWNBTFZZ.js');
3
+ var chunkVI5DQRQZ_js = require('./chunk-VI5DQRQZ.js');
4
+ var chunkV3XADJ2O_js = require('./chunk-V3XADJ2O.js');
5
+ var chunkZ22RD3E2_js = require('./chunk-Z22RD3E2.js');
6
6
  require('./chunk-PIRHQTI4.js');
7
7
  var pptx = require('ooxml-ui/pptx');
8
8
  var i18n = require('ooxml-ui/pptx/i18n');
@@ -11,87 +11,91 @@ var i18n = require('ooxml-ui/pptx/i18n');
11
11
 
12
12
  Object.defineProperty(exports, "PowerPointViewer", {
13
13
  enumerable: true,
14
- get: function () { return chunk4OF7X5EE_js.PowerPointViewer; }
14
+ get: function () { return chunkVI5DQRQZ_js.PowerPointViewer; }
15
+ });
16
+ Object.defineProperty(exports, "PptxI18nProvider", {
17
+ enumerable: true,
18
+ get: function () { return chunkVI5DQRQZ_js.PptxI18nProvider; }
15
19
  });
16
20
  Object.defineProperty(exports, "SlideCanvas", {
17
21
  enumerable: true,
18
- get: function () { return chunk4OF7X5EE_js.SlideCanvas; }
22
+ get: function () { return chunkVI5DQRQZ_js.SlideCanvas; }
19
23
  });
20
24
  Object.defineProperty(exports, "SlideTemplateGalleryDialog", {
21
25
  enumerable: true,
22
- get: function () { return chunk4OF7X5EE_js.SlideTemplateGalleryDialog; }
26
+ get: function () { return chunkVI5DQRQZ_js.SlideTemplateGalleryDialog; }
23
27
  });
24
28
  Object.defineProperty(exports, "SlideTemplatePreview", {
25
29
  enumerable: true,
26
- get: function () { return chunk4OF7X5EE_js.SlideTemplatePreview; }
30
+ get: function () { return chunkVI5DQRQZ_js.SlideTemplatePreview; }
27
31
  });
28
32
  Object.defineProperty(exports, "THEME_CATALOG", {
29
33
  enumerable: true,
30
- get: function () { return chunk4OF7X5EE_js.THEME_CATALOG; }
34
+ get: function () { return chunkVI5DQRQZ_js.THEME_CATALOG; }
31
35
  });
32
36
  Object.defineProperty(exports, "Toolbar", {
33
37
  enumerable: true,
34
- get: function () { return chunk4OF7X5EE_js.Toolbar; }
38
+ get: function () { return chunkVI5DQRQZ_js.Toolbar; }
35
39
  });
36
40
  Object.defineProperty(exports, "ViewerThemeProvider", {
37
41
  enumerable: true,
38
- get: function () { return chunk4OF7X5EE_js.ViewerThemeProvider; }
42
+ get: function () { return chunkVI5DQRQZ_js.ViewerThemeProvider; }
39
43
  });
40
44
  Object.defineProperty(exports, "defaultCssVars", {
41
45
  enumerable: true,
42
- get: function () { return chunk4OF7X5EE_js.defaultCssVars; }
46
+ get: function () { return chunkVI5DQRQZ_js.defaultCssVars; }
43
47
  });
44
48
  Object.defineProperty(exports, "defaultRadius", {
45
49
  enumerable: true,
46
- get: function () { return chunk4OF7X5EE_js.defaultRadius; }
50
+ get: function () { return chunkVI5DQRQZ_js.defaultRadius; }
47
51
  });
48
52
  Object.defineProperty(exports, "defaultThemeColors", {
49
53
  enumerable: true,
50
- get: function () { return chunk4OF7X5EE_js.defaultThemeColors; }
54
+ get: function () { return chunkVI5DQRQZ_js.defaultThemeColors; }
51
55
  });
52
56
  Object.defineProperty(exports, "resolveThemeCatalogEntry", {
53
57
  enumerable: true,
54
- get: function () { return chunk4OF7X5EE_js.resolveThemeCatalogEntry; }
58
+ get: function () { return chunkVI5DQRQZ_js.resolveThemeCatalogEntry; }
55
59
  });
56
60
  Object.defineProperty(exports, "themeToCssVars", {
57
61
  enumerable: true,
58
- get: function () { return chunk4OF7X5EE_js.themeToCssVars; }
62
+ get: function () { return chunkVI5DQRQZ_js.themeToCssVars; }
59
63
  });
60
64
  Object.defineProperty(exports, "useViewerTheme", {
61
65
  enumerable: true,
62
- get: function () { return chunk4OF7X5EE_js.useViewerTheme; }
66
+ get: function () { return chunkVI5DQRQZ_js.useViewerTheme; }
63
67
  });
64
68
  Object.defineProperty(exports, "vermilionDarkColors", {
65
69
  enumerable: true,
66
- get: function () { return chunk4OF7X5EE_js.vermilionDarkColors; }
70
+ get: function () { return chunkVI5DQRQZ_js.vermilionDarkColors; }
67
71
  });
68
72
  Object.defineProperty(exports, "vermilionDarkTheme", {
69
73
  enumerable: true,
70
- get: function () { return chunk4OF7X5EE_js.vermilionDarkTheme; }
74
+ get: function () { return chunkVI5DQRQZ_js.vermilionDarkTheme; }
71
75
  });
72
76
  Object.defineProperty(exports, "vermilionLightColors", {
73
77
  enumerable: true,
74
- get: function () { return chunk4OF7X5EE_js.vermilionLightColors; }
78
+ get: function () { return chunkVI5DQRQZ_js.vermilionLightColors; }
75
79
  });
76
80
  Object.defineProperty(exports, "vermilionLightTheme", {
77
81
  enumerable: true,
78
- get: function () { return chunk4OF7X5EE_js.vermilionLightTheme; }
82
+ get: function () { return chunkVI5DQRQZ_js.vermilionLightTheme; }
79
83
  });
80
84
  Object.defineProperty(exports, "vermilionRadius", {
81
85
  enumerable: true,
82
- get: function () { return chunk4OF7X5EE_js.vermilionRadius; }
86
+ get: function () { return chunkVI5DQRQZ_js.vermilionRadius; }
83
87
  });
84
88
  Object.defineProperty(exports, "renderToCanvas", {
85
89
  enumerable: true,
86
- get: function () { return chunkD5NXYXPP_js.renderToCanvas; }
90
+ get: function () { return chunkV3XADJ2O_js.renderToCanvas; }
87
91
  });
88
92
  Object.defineProperty(exports, "useViewerBuildingBlocks", {
89
93
  enumerable: true,
90
- get: function () { return chunkD5NXYXPP_js.useViewerBuildingBlocks; }
94
+ get: function () { return chunkV3XADJ2O_js.useViewerBuildingBlocks; }
91
95
  });
92
96
  Object.defineProperty(exports, "getAnimationInitialStyle", {
93
97
  enumerable: true,
94
- get: function () { return chunkJWNBTFZZ_js.getAnimationInitialStyle; }
98
+ get: function () { return chunkZ22RD3E2_js.getAnimationInitialStyle; }
95
99
  });
96
100
  Object.defineProperty(exports, "AVATAR_COLOR_SWATCHES", {
97
101
  enumerable: true,
package/dist/index.js.br CHANGED
Binary file
package/dist/index.js.gz CHANGED
Binary file
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { PowerPointViewer, SlideCanvas, SlideTemplateGalleryDialog, SlideTemplatePreview, THEME_CATALOG, Toolbar, ViewerThemeProvider, defaultCssVars, defaultRadius, defaultThemeColors, resolveThemeCatalogEntry, themeToCssVars, useViewerTheme, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius } from './chunk-5JJQLK7N.mjs';
2
- export { renderToCanvas, useViewerBuildingBlocks } from './chunk-QHGEPW5G.mjs';
3
- export { getAnimationInitialStyle } from './chunk-77IXTLKU.mjs';
1
+ export { PowerPointViewer, PptxI18nProvider, SlideCanvas, SlideTemplateGalleryDialog, SlideTemplatePreview, THEME_CATALOG, Toolbar, ViewerThemeProvider, defaultCssVars, defaultRadius, defaultThemeColors, resolveThemeCatalogEntry, themeToCssVars, useViewerTheme, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius } from './chunk-ETJ752B5.mjs';
2
+ export { renderToCanvas, useViewerBuildingBlocks } from './chunk-ACFR4LFQ.mjs';
3
+ export { getAnimationInitialStyle } from './chunk-ZCGYPCZM.mjs';
4
4
  import './chunk-UV2HVMKZ.mjs';
5
5
  export { AVATAR_COLOR_SWATCHES, BACKSTAGE_CARD_IDS, BACKSTAGE_PAGE_IDS, CANVAS_CONTEXT_MENU_COMMAND_IDS, DEFAULT_VIEWER_PROFILE, EDITOR_SHORTCUT_ACTION_IDS, ELEMENT_CONTEXT_MENU_COMMAND_IDS, OPTIONS_PAGE_IDS, OPTIONS_SECTION_IDS, OPTIONS_SETTING_IDS, PPTX_OPEN_ACCEPT, PRESENTATION_OPEN_EXTENSIONS, RIBBON_TAB_IDS, SLIDE_TEMPLATES, TOOLBAR_BUTTON_IDS, VIEWER_DIALOG_IDS, VIEWER_EXPORT_FORMAT_IDS, VIEWER_FEATURE_IDS, VIEWER_PANEL_IDS, VIEWER_PREFS_STORAGE_KEY, buildSlideTemplateContent, buildSlideTemplateSlide, clearAllLocalViewerData, clearStoredViewerPrefs, createImageElementFromFile, describeCollaborationShellState, getLocalStorageUsageSummary, isLegacyBinaryPresentation, isSupportedPresentationFile, presentationBaseName, readStoredViewerPrefs, resolveProfileInitial, saveViewerProfile, savedPresentationFileName, writeStoredViewerPrefs } from 'ooxml-ui/pptx';
6
6
  export { LOCALE_CATALOG } from 'ooxml-ui/pptx/i18n';
package/dist/index.mjs.br CHANGED
Binary file
package/dist/index.mjs.gz CHANGED
Binary file