pptx-react-viewer 4.49.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 (124) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/README.md +38 -4
  3. package/dist/{AiChatPanel-S4WNQCY4.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-NKTBHT5B.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-Z62JFXMZ.mjs → chunk-ACFR4LFQ.mjs} +577 -1028
  10. package/dist/chunk-ACFR4LFQ.mjs.br +0 -0
  11. package/dist/chunk-ACFR4LFQ.mjs.gz +0 -0
  12. package/dist/chunk-DDJ634MV.js.br +0 -0
  13. package/dist/chunk-DDJ634MV.js.gz +0 -0
  14. package/dist/{chunk-YKLL2Z33.mjs → chunk-ETJ752B5.mjs} +597 -1871
  15. package/dist/chunk-ETJ752B5.mjs.br +0 -0
  16. package/dist/chunk-ETJ752B5.mjs.gz +0 -0
  17. package/dist/chunk-QIUK53JR.mjs.br +0 -0
  18. package/dist/chunk-QIUK53JR.mjs.gz +0 -0
  19. package/dist/{chunk-ME5QRTVS.js → chunk-V3XADJ2O.js} +763 -1214
  20. package/dist/chunk-V3XADJ2O.js.br +0 -0
  21. package/dist/chunk-V3XADJ2O.js.gz +0 -0
  22. package/dist/{chunk-2ZXXHNNR.js → chunk-VI5DQRQZ.js} +2052 -3325
  23. package/dist/chunk-VI5DQRQZ.js.br +0 -0
  24. package/dist/chunk-VI5DQRQZ.js.gz +0 -0
  25. package/dist/{chunk-JAI42EXQ.js → chunk-Z22RD3E2.js} +41 -12
  26. package/dist/chunk-Z22RD3E2.js.br +0 -0
  27. package/dist/chunk-Z22RD3E2.js.gz +0 -0
  28. package/dist/{chunk-PFV626ED.mjs → chunk-ZCGYPCZM.mjs} +37 -8
  29. package/dist/chunk-ZCGYPCZM.mjs.br +0 -0
  30. package/dist/chunk-ZCGYPCZM.mjs.gz +0 -0
  31. package/dist/i18n/de.cjs +1138 -221
  32. package/dist/i18n/de.cjs.br +0 -0
  33. package/dist/i18n/de.cjs.gz +0 -0
  34. package/dist/i18n/de.mjs +1138 -221
  35. package/dist/i18n/de.mjs.br +0 -0
  36. package/dist/i18n/de.mjs.gz +0 -0
  37. package/dist/i18n/es.cjs +1138 -221
  38. package/dist/i18n/es.cjs.br +0 -0
  39. package/dist/i18n/es.cjs.gz +0 -0
  40. package/dist/i18n/es.mjs +1138 -221
  41. package/dist/i18n/es.mjs.br +0 -0
  42. package/dist/i18n/es.mjs.gz +0 -0
  43. package/dist/i18n/fr.cjs +1138 -221
  44. package/dist/i18n/fr.cjs.br +0 -0
  45. package/dist/i18n/fr.cjs.gz +0 -0
  46. package/dist/i18n/fr.mjs +1138 -221
  47. package/dist/i18n/fr.mjs.br +0 -0
  48. package/dist/i18n/fr.mjs.gz +0 -0
  49. package/dist/i18n/zh-CN.cjs +1138 -221
  50. package/dist/i18n/zh-CN.cjs.br +0 -0
  51. package/dist/i18n/zh-CN.cjs.gz +0 -0
  52. package/dist/i18n/zh-CN.mjs +1138 -221
  53. package/dist/i18n/zh-CN.mjs.br +0 -0
  54. package/dist/i18n/zh-CN.mjs.gz +0 -0
  55. package/dist/index.d.ts +56 -27
  56. package/dist/index.js +28 -24
  57. package/dist/index.js.br +0 -0
  58. package/dist/index.js.gz +0 -0
  59. package/dist/index.mjs +3 -3
  60. package/dist/index.mjs.br +0 -0
  61. package/dist/index.mjs.gz +0 -0
  62. package/dist/internals.d.ts +105 -94
  63. package/dist/internals.js +81 -81
  64. package/dist/internals.js.br +0 -0
  65. package/dist/internals.js.gz +0 -0
  66. package/dist/internals.mjs +2 -2
  67. package/dist/internals.mjs.br +0 -0
  68. package/dist/internals.mjs.gz +0 -0
  69. package/dist/pptx-viewer-canvas.css +1 -1
  70. package/dist/pptx-viewer-canvas.css.br +0 -0
  71. package/dist/pptx-viewer-canvas.css.gz +0 -0
  72. package/dist/pptx-viewer.css +1 -1
  73. package/dist/pptx-viewer.css.br +0 -0
  74. package/dist/pptx-viewer.css.gz +0 -0
  75. package/dist/viewer/index.d.ts +58 -24
  76. package/dist/viewer/index.js +23 -19
  77. package/dist/viewer/index.js.br +0 -0
  78. package/dist/viewer/index.js.gz +0 -0
  79. package/dist/viewer/index.mjs +3 -3
  80. package/dist/viewer/index.mjs.br +0 -0
  81. package/dist/viewer/index.mjs.gz +0 -0
  82. package/dist/{y-webrtc-2H7UYAQD.mjs → y-webrtc-HRGGVQZH.mjs} +1 -1
  83. package/dist/y-webrtc-HRGGVQZH.mjs.br +0 -0
  84. package/dist/y-webrtc-HRGGVQZH.mjs.gz +0 -0
  85. package/dist/{y-webrtc-DVPQNFLL.js → y-webrtc-QVVT5PCK.js} +124 -124
  86. package/dist/y-webrtc-QVVT5PCK.js.br +0 -0
  87. package/dist/y-webrtc-QVVT5PCK.js.gz +0 -0
  88. package/dist/{y-websocket-WORVRRQS.mjs → y-websocket-46M6UFI7.mjs} +1 -1
  89. package/dist/y-websocket-46M6UFI7.mjs.br +0 -0
  90. package/dist/y-websocket-46M6UFI7.mjs.gz +0 -0
  91. package/dist/{y-websocket-TN4OKPXQ.js → y-websocket-EDOMWMAD.js} +78 -78
  92. package/dist/y-websocket-EDOMWMAD.js.br +0 -0
  93. package/dist/y-websocket-EDOMWMAD.js.gz +0 -0
  94. package/package.json +3 -3
  95. package/dist/AiChatPanel-NKTBHT5B.mjs.br +0 -0
  96. package/dist/AiChatPanel-NKTBHT5B.mjs.gz +0 -0
  97. package/dist/AiChatPanel-S4WNQCY4.js.br +0 -0
  98. package/dist/AiChatPanel-S4WNQCY4.js.gz +0 -0
  99. package/dist/chunk-2ZXXHNNR.js.br +0 -0
  100. package/dist/chunk-2ZXXHNNR.js.gz +0 -0
  101. package/dist/chunk-3VVZGHHY.mjs.br +0 -0
  102. package/dist/chunk-3VVZGHHY.mjs.gz +0 -0
  103. package/dist/chunk-JAI42EXQ.js.br +0 -0
  104. package/dist/chunk-JAI42EXQ.js.gz +0 -0
  105. package/dist/chunk-ME5QRTVS.js.br +0 -0
  106. package/dist/chunk-ME5QRTVS.js.gz +0 -0
  107. package/dist/chunk-NUNDT6EL.js.br +0 -0
  108. package/dist/chunk-NUNDT6EL.js.gz +0 -0
  109. package/dist/chunk-PFV626ED.mjs.br +0 -0
  110. package/dist/chunk-PFV626ED.mjs.gz +0 -0
  111. package/dist/chunk-YKLL2Z33.mjs.br +0 -0
  112. package/dist/chunk-YKLL2Z33.mjs.gz +0 -0
  113. package/dist/chunk-Z62JFXMZ.mjs.br +0 -0
  114. package/dist/chunk-Z62JFXMZ.mjs.gz +0 -0
  115. package/dist/y-webrtc-2H7UYAQD.mjs.br +0 -0
  116. package/dist/y-webrtc-2H7UYAQD.mjs.gz +0 -0
  117. package/dist/y-webrtc-DVPQNFLL.js.br +0 -0
  118. package/dist/y-webrtc-DVPQNFLL.js.gz +0 -0
  119. package/dist/y-websocket-TN4OKPXQ.js.br +0 -0
  120. package/dist/y-websocket-TN4OKPXQ.js.gz +0 -0
  121. package/dist/y-websocket-WORVRRQS.mjs.br +0 -0
  122. package/dist/y-websocket-WORVRRQS.mjs.gz +0 -0
  123. package/dist/{chunk-NUNDT6EL.js → chunk-DDJ634MV.js} +436 -436
  124. package/dist/{chunk-3VVZGHHY.mjs → chunk-QIUK53JR.mjs} +436 -436
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
  }
@@ -103,7 +133,6 @@ var ARROW_SIZE_OPTIONS = [
103
133
  { value: "med", label: "Medium", i18nKey: "pptx.connectorOptions.sizeMedium" },
104
134
  { value: "lg", label: "Large", i18nKey: "pptx.connectorOptions.sizeLarge" }
105
135
  ];
106
- var STROKE_DASH_OPTIONS = pptx.STROKE_DASH_OPTIONS;
107
136
 
108
137
  // src/viewer/utils/shape-types.tsx
109
138
  function getShapeType(shapeType) {
@@ -448,7 +477,7 @@ function PresentationMediaController({
448
477
  onPlayStateChange,
449
478
  children
450
479
  }) {
451
- const { t } = reactI18next.useTranslation();
480
+ const { t } = useTranslation();
452
481
  const mediaRef = React8.useRef(null);
453
482
  const [isMediaPlaying, setIsMediaPlaying] = React8.useState(false);
454
483
  const trimStartSec = element.trimStartMs !== void 0 ? element.trimStartMs / 1e3 : 0;
@@ -1329,7 +1358,7 @@ function renderHyperlink(run, spanNode, key, ctx) {
1329
1358
  );
1330
1359
  }
1331
1360
  function FollowLinkHint() {
1332
- const { t } = reactI18next.useTranslation();
1361
+ const { t } = useTranslation();
1333
1362
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: t("pptx.linkTooltip.followLink") });
1334
1363
  }
1335
1364
  function wrapWithTextReflection(run, key, spanNode, spanStyle, baseContent) {
@@ -4019,10 +4048,6 @@ Object.defineProperty(exports, "computeHandoutLayout", {
4019
4048
  enumerable: true,
4020
4049
  get: function () { return pptx.computeHandoutLayout; }
4021
4050
  });
4022
- Object.defineProperty(exports, "computeSnapToShape", {
4023
- enumerable: true,
4024
- get: function () { return pptx.computeSnapToShape; }
4025
- });
4026
4051
  Object.defineProperty(exports, "copyFormatFromElement", {
4027
4052
  enumerable: true,
4028
4053
  get: function () { return pptx.copyFormatFromElement; }
@@ -4215,12 +4240,14 @@ exports.DEFAULT_TEXT_FONT_SIZE = DEFAULT_TEXT_FONT_SIZE;
4215
4240
  exports.GRID_SIZE = GRID_SIZE;
4216
4241
  exports.HYPERLINK_COLOR = HYPERLINK_COLOR;
4217
4242
  exports.MIN_ELEMENT_SIZE = MIN_ELEMENT_SIZE;
4243
+ exports.PptxI18nContext = PptxI18nContext;
4218
4244
  exports.SHAPE_PRESETS = SHAPE_PRESETS;
4219
4245
  exports.SHORTCUT_REFERENCE_ITEMS = SHORTCUT_REFERENCE_ITEMS;
4220
4246
  exports.SLIDE_NAV_THUMBNAIL_WIDTH = SLIDE_NAV_THUMBNAIL_WIDTH;
4221
- exports.STROKE_DASH_OPTIONS = STROKE_DASH_OPTIONS;
4222
4247
  exports.TOOLBAR_SECTIONS = TOOLBAR_SECTIONS;
4223
4248
  exports.UNGROUPED_SECTION_ID = UNGROUPED_SECTION_ID;
4249
+ exports.ViewerI18nContext = ViewerI18nContext;
4250
+ exports.ViewerLocaleControlsContext = ViewerLocaleControlsContext;
4224
4251
  exports.ZOOM_TO_SELECTION_PADDING = ZOOM_TO_SELECTION_PADDING;
4225
4252
  exports.build3DExtrusionData = build3DExtrusionData;
4226
4253
  exports.buildLineGlowFilter = buildLineGlowFilter;
@@ -4256,3 +4283,5 @@ exports.shouldRenderFallbackLabel = shouldRenderFallbackLabel;
4256
4283
  exports.startMotionPathPreview = startMotionPathPreview;
4257
4284
  exports.startPreviewAnimation = startPreviewAnimation;
4258
4285
  exports.stopPreviewAnimation = stopPreviewAnimation;
4286
+ exports.useHostI18next = useHostI18next;
4287
+ exports.useTranslation = useTranslation;
Binary file
Binary file
@@ -1,16 +1,46 @@
1
- import { VIEWER_SHORTCUT_REFERENCE, STROKE_DASH_OPTIONS as STROKE_DASH_OPTIONS$1, 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
- 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, computeSnapToShape, 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';
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';
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';
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
  }
@@ -99,7 +129,6 @@ var ARROW_SIZE_OPTIONS = [
99
129
  { value: "med", label: "Medium", i18nKey: "pptx.connectorOptions.sizeMedium" },
100
130
  { value: "lg", label: "Large", i18nKey: "pptx.connectorOptions.sizeLarge" }
101
131
  ];
102
- var STROKE_DASH_OPTIONS = STROKE_DASH_OPTIONS$1;
103
132
 
104
133
  // src/viewer/utils/shape-types.tsx
105
134
  function getShapeType(shapeType) {
@@ -3927,4 +3956,4 @@ function stopPreviewAnimation() {
3927
3956
  activePreview = null;
3928
3957
  }
3929
3958
 
3930
- 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, STROKE_DASH_OPTIONS, 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