pptx-react-viewer 4.74.0 → 4.75.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.
- package/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/dist/{AiChatPanel-PLQ3NBTK.js → AiChatPanel-4V7QB5Z3.js} +19 -19
- package/dist/AiChatPanel-4V7QB5Z3.js.br +0 -0
- package/dist/AiChatPanel-4V7QB5Z3.js.gz +0 -0
- package/dist/{AiChatPanel-E7CJSTW7.mjs → AiChatPanel-6ML3VLIX.mjs} +1 -1
- package/dist/AiChatPanel-6ML3VLIX.mjs.br +0 -0
- package/dist/AiChatPanel-6ML3VLIX.mjs.gz +0 -0
- package/dist/ai.js +2 -2
- package/dist/ai.js.br +0 -0
- package/dist/ai.js.gz +0 -0
- package/dist/ai.mjs +1 -1
- package/dist/ai.mjs.br +0 -0
- package/dist/ai.mjs.gz +0 -0
- package/dist/{chunk-XG4WSJ4O.js → chunk-3AZ6ESJU.js} +203 -203
- package/dist/chunk-3AZ6ESJU.js.br +0 -0
- package/dist/chunk-3AZ6ESJU.js.gz +0 -0
- package/dist/{chunk-P2COO2QO.js → chunk-6GFSF2ML.js} +65 -13
- package/dist/chunk-6GFSF2ML.js.br +0 -0
- package/dist/chunk-6GFSF2ML.js.gz +0 -0
- package/dist/{chunk-CRC3V4UG.mjs → chunk-AZLOOFU2.mjs} +1 -1
- package/dist/chunk-AZLOOFU2.mjs.br +0 -0
- package/dist/chunk-AZLOOFU2.mjs.gz +0 -0
- package/dist/{chunk-SQ7OASDY.mjs → chunk-DE4Y5F4T.mjs} +40 -44
- package/dist/chunk-DE4Y5F4T.mjs.br +0 -0
- package/dist/chunk-DE4Y5F4T.mjs.gz +0 -0
- package/dist/chunk-FFTZYNL4.mjs +2 -0
- package/dist/chunk-FFTZYNL4.mjs.br +6 -0
- package/dist/chunk-FFTZYNL4.mjs.gz +0 -0
- package/dist/chunk-LWGPHJHC.js +151 -0
- package/dist/chunk-LWGPHJHC.js.br +0 -0
- package/dist/chunk-LWGPHJHC.js.gz +0 -0
- package/dist/{chunk-LVEFHZ76.js → chunk-MU3BIZ2U.js} +1 -1
- package/dist/chunk-MU3BIZ2U.js.br +0 -0
- package/dist/chunk-MU3BIZ2U.js.gz +0 -0
- package/dist/{chunk-FBSPQYRE.mjs → chunk-N3YK2BCA.mjs} +61 -14
- package/dist/chunk-N3YK2BCA.mjs.br +0 -0
- package/dist/chunk-N3YK2BCA.mjs.gz +0 -0
- package/dist/chunk-P2IEKYVG.js +29 -0
- package/dist/chunk-P2IEKYVG.js.br +0 -0
- package/dist/chunk-P2IEKYVG.js.gz +0 -0
- package/dist/{chunk-D4WC35PL.js → chunk-RJRDE3C2.js} +594 -599
- package/dist/chunk-RJRDE3C2.js.br +0 -0
- package/dist/chunk-RJRDE3C2.js.gz +0 -0
- package/dist/{chunk-JZE6BORE.mjs → chunk-RMEWSJZU.mjs} +1 -1
- package/dist/chunk-RMEWSJZU.mjs.br +0 -0
- package/dist/chunk-RMEWSJZU.mjs.gz +0 -0
- package/dist/chunk-Y53EC3JU.mjs +27 -0
- package/dist/chunk-Y53EC3JU.mjs.br +0 -0
- package/dist/chunk-Y53EC3JU.mjs.gz +0 -0
- package/dist/index.d.ts +24 -18
- package/dist/index.js +126 -126
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.js +82 -81
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +3 -2
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/no-i18next.d.ts +1299 -0
- package/dist/no-i18next.js +251 -0
- package/dist/no-i18next.js.br +0 -0
- package/dist/no-i18next.js.gz +0 -0
- package/dist/no-i18next.mjs +6 -0
- package/dist/no-i18next.mjs.br +0 -0
- package/dist/no-i18next.mjs.gz +0 -0
- package/dist/viewer/index.d.ts +24 -18
- package/dist/viewer/index.js +25 -24
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +5 -4
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +9 -4
- package/dist/AiChatPanel-E7CJSTW7.mjs.br +0 -0
- package/dist/AiChatPanel-E7CJSTW7.mjs.gz +0 -0
- package/dist/AiChatPanel-PLQ3NBTK.js.br +0 -0
- package/dist/AiChatPanel-PLQ3NBTK.js.gz +0 -0
- package/dist/chunk-CRC3V4UG.mjs.br +0 -0
- package/dist/chunk-CRC3V4UG.mjs.gz +0 -0
- package/dist/chunk-D4WC35PL.js.br +0 -0
- package/dist/chunk-D4WC35PL.js.gz +0 -0
- package/dist/chunk-FBSPQYRE.mjs.br +0 -0
- package/dist/chunk-FBSPQYRE.mjs.gz +0 -0
- package/dist/chunk-JZE6BORE.mjs.br +0 -0
- package/dist/chunk-JZE6BORE.mjs.gz +0 -0
- package/dist/chunk-LVEFHZ76.js.br +0 -0
- package/dist/chunk-LVEFHZ76.js.gz +0 -0
- package/dist/chunk-P2COO2QO.js.br +0 -0
- package/dist/chunk-P2COO2QO.js.gz +0 -0
- package/dist/chunk-SQ7OASDY.mjs.br +0 -0
- package/dist/chunk-SQ7OASDY.mjs.gz +0 -0
- package/dist/chunk-XG4WSJ4O.js.br +0 -0
- package/dist/chunk-XG4WSJ4O.js.gz +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { interpolate } from 'ooxml-core/i18n';
|
|
1
2
|
import { translationsEn, keyToLabel } from 'ooxml-ui/pptx/i18n';
|
|
2
|
-
import React8, { createContext, useContext, useState,
|
|
3
|
-
import {
|
|
3
|
+
import React8, { createContext, useMemo, useContext, useState, useRef, useEffect, useCallback, useLayoutEffect } from 'react';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
5
|
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, isWedgeCalloutPresetShape, getFrameEffectStyle, getComputedEffectStyle, getComputedStrokeStyle, getAnimationColorBaseStyle, isStrokeOnlyPresetElement, resolveShapeGeometry, screenBorderWidth, markerPath, normalizeStrokeDashType, getSvgStrokeDasharray, buildSvgGradientDef, isArrowedCustomPath, buildStrokeOutline, getPresetShapeVectorGeometry, screenStrokeWidth, svgGradientFillRef, svgLineCap, getCompoundLineOffsets, getCompoundLineWidths, connectorSnapTransform, connectorNeedsPath, connectorStrandScreenWidth, buildChartViewModel, resolveChartKind, chartPreserveAspectRatio, buildNotesPdfBytes, buildTiledSlidesPdfBytes, buildPreviewAnimation, measurePreviewGeometry, buildMotionPathPreview, mediaFallbackVisual, scheduleMediaTrimAndFade, registerCrossSlideAudio, shouldShowMediaFullscreenStopButton, withInlineListDecorationDefaults, segmentStyleToCss, resolveAutoFitFontScale, applyUnderlineVariant, nestedTextDecorationStyle, textRunColor, scaleFontSizeForAutoFit, resolveFontKerning, resolveScriptFontSet, hasDistinctScriptFonts, authoredLetterSpacingPx, eastAsianBreaksForRun, pieceLetterSpacing, resolveMetricTrackingPx, hollowTextFillStyle, splitsUnderlineIntoWords, stripUnderlineDecoration, buildTabContext, TEXT_BUILD_ID_SEP, buildTextBuildSpec, textBuildSpanStyle, apply3dEffects as apply3dEffects$1, buildSubpathPaints, canDrillDown, computeSelectionRect, DEFAULT_FONT_FAMILY as DEFAULT_FONT_FAMILY$1, isCellInRect, rectToCells, tableContainerCss, resolveChartPalette, computeChartLegendLayout, resolveChartSvgDef, mediaFallbackIcon, mediaFallbackLabelKey, MEDIA_CHROME_ATTRIBUTE, attachMediaControlBar, convertOmmlToMathMl, sanitizeMathMl, dashStartPathData, computeColumnBoundaries, computeTableMergeCrossings, columnHandleSegments, rowHandleSegments, getCellDiagonalBorders as getCellDiagonalBorders$1, tableCellCss, cellParagraphBlocks, buildRunTabLines, computeResizedColumnWidths, computeResizedRowHeight, DEFAULT_ROW_HEIGHT, cellRunStyle, chartPartToAttrs, splitWordsForUnderline, splitRunForMetrics, splitEastAsianBreaks, splitRunByScriptFont } from 'ooxml-ui/pptx';
|
|
5
6
|
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, getTextCompensationOrigin, 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';
|
|
6
7
|
import { clsx } from 'clsx';
|
|
@@ -8,9 +9,8 @@ import { twMerge } from 'tailwind-merge';
|
|
|
8
9
|
import { LuTriangle, LuPlus, LuMoveRight, LuMinus, LuDiamond, LuDatabase, LuCircle, LuSquare } from 'react-icons/lu';
|
|
9
10
|
import { hasShapeProperties, isImageLikeElement, hasTextProperties, getConnectorPathGeometry as getConnectorPathGeometry$1, isCalloutShape, getCalloutLeaderLineGeometry, buildCalloutLeaderLineSvgPath, getCalloutViewBoxBounds, getSubstituteFontFamily, parsePanoseString, customGeometryPathsToSvgSubpaths } from 'ooxml-core/pptx';
|
|
10
11
|
export { updateCellTextInRawXml, updateCellTextStyleInRawXml, updateMergeAttrsInRawXml } from 'ooxml-core/pptx';
|
|
11
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
12
12
|
|
|
13
|
-
// src/viewer/i18n/
|
|
13
|
+
// src/viewer/i18n/provider.tsx
|
|
14
14
|
var ViewerI18nContext = /* @__PURE__ */ createContext(null);
|
|
15
15
|
var PptxI18nContext = /* @__PURE__ */ createContext(null);
|
|
16
16
|
var NO_LOCALE_CONTROLS = {
|
|
@@ -21,25 +21,72 @@ var NO_LOCALE_CONTROLS = {
|
|
|
21
21
|
languageSelectable: true
|
|
22
22
|
};
|
|
23
23
|
var ViewerLocaleControlsContext = /* @__PURE__ */ createContext(NO_LOCALE_CONTROLS);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
24
|
+
var asMessageParams = (params) => params;
|
|
25
|
+
function withEnglishFallback(translate) {
|
|
26
|
+
return (key, defaultOrParams) => {
|
|
27
|
+
const params = typeof defaultOrParams === "string" ? { defaultValue: defaultOrParams } : defaultOrParams;
|
|
28
|
+
let text;
|
|
29
|
+
try {
|
|
30
|
+
text = params === void 0 ? translate(key) : translate(key, params);
|
|
31
|
+
} catch {
|
|
32
|
+
text = void 0;
|
|
33
|
+
}
|
|
34
|
+
const found = text && text !== key ? text : translationsEn[key] ?? params?.defaultValue;
|
|
35
|
+
return typeof found === "string" ? interpolate(found, asMessageParams(params), "double") : keyToLabel(key);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
var BUILT_IN_ENGLISH = {
|
|
39
|
+
t: withEnglishFallback(() => void 0),
|
|
40
|
+
locale: "en"
|
|
41
|
+
};
|
|
42
|
+
function PptxI18nProvider({
|
|
43
|
+
translate,
|
|
44
|
+
locale,
|
|
45
|
+
children
|
|
46
|
+
}) {
|
|
47
|
+
const state = useMemo(
|
|
48
|
+
() => ({ t: withEnglishFallback(translate), locale }),
|
|
49
|
+
[translate, locale]
|
|
50
|
+
);
|
|
51
|
+
return /* @__PURE__ */ jsx(PptxI18nContext.Provider, { value: state, children });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/viewer/i18n/host-i18next.ts
|
|
55
|
+
var registered = null;
|
|
56
|
+
function registerHostI18next(useHostI18next) {
|
|
57
|
+
registered ??= useHostI18next;
|
|
58
|
+
}
|
|
59
|
+
function registeredHostI18next() {
|
|
60
|
+
return registered;
|
|
61
|
+
}
|
|
62
|
+
function hostInstanceLanguage(i18n) {
|
|
63
|
+
const { resolvedLanguage, language } = i18n;
|
|
64
|
+
if (typeof resolvedLanguage === "string") {
|
|
65
|
+
return resolvedLanguage;
|
|
66
|
+
}
|
|
67
|
+
return typeof language === "string" ? language : void 0;
|
|
68
|
+
}
|
|
69
|
+
function useRegisteredHostI18next() {
|
|
70
|
+
if (!registered) {
|
|
71
|
+
throw new Error("No react-i18next source is registered");
|
|
72
|
+
}
|
|
73
|
+
return registered();
|
|
27
74
|
}
|
|
28
75
|
|
|
29
76
|
// src/viewer/i18n/use-translation.ts
|
|
30
|
-
var LABELS_ONLY = { t: (key) => keyToLabel(key), locale: "en" };
|
|
31
77
|
function useHostTranslation() {
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
78
|
+
const host = useRegisteredHostI18next();
|
|
79
|
+
const t = host?.t;
|
|
80
|
+
const language = (host && hostInstanceLanguage(host.i18n)) ?? "en";
|
|
81
|
+
return useMemo(() => t ? { t, locale: language } : null, [t, language]);
|
|
35
82
|
}
|
|
36
83
|
function useTranslation() {
|
|
37
84
|
const fromRoot = useContext(ViewerI18nContext);
|
|
38
85
|
const provided = useContext(PptxI18nContext);
|
|
39
86
|
const resolved = fromRoot ?? provided;
|
|
40
|
-
const [readsHost] = useState(resolved === null);
|
|
87
|
+
const [readsHost] = useState(() => resolved === null && registeredHostI18next() !== null);
|
|
41
88
|
const host = readsHost ? useHostTranslation() : null;
|
|
42
|
-
return resolved ?? host ??
|
|
89
|
+
return resolved ?? host ?? BUILT_IN_ENGLISH;
|
|
43
90
|
}
|
|
44
91
|
function getAnimationInitialStyle(preset, nativeAnimation) {
|
|
45
92
|
return getAnimationInitialStyle$1(preset, nativeAnimation);
|
|
@@ -3297,4 +3344,4 @@ function stopPreviewAnimation() {
|
|
|
3297
3344
|
activePreview = null;
|
|
3298
3345
|
}
|
|
3299
3346
|
|
|
3300
|
-
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, 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, rendersCustomVectorPath, rendersWedgeCalloutVector, shouldRenderFallbackLabel, startMotionPathPreview, startPreviewAnimation, stopPreviewAnimation,
|
|
3347
|
+
export { ANIMATION_PRESET_OPTIONS, ARROW_SIZE_OPTIONS, BUILT_IN_ENGLISH, 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, MIN_ELEMENT_SIZE, PptxI18nContext, PptxI18nProvider, 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, hostInstanceLanguage, isConnectorOrLineElement, registerHostI18next, registeredHostI18next, renderChartElement, renderConnectorMarker, renderDagDuotoneSvgFilter, renderMediaElement, renderTableElement, renderTextSegments, renderVectorShape, rendersCustomVectorPath, rendersWedgeCalloutVector, shouldRenderFallbackLabel, startMotionPathPreview, startPreviewAnimation, stopPreviewAnimation, useRegisteredHostI18next, useTranslation };
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk6GFSF2ML_js = require('./chunk-6GFSF2ML.js');
|
|
4
|
+
var reactI18next = require('react-i18next');
|
|
5
|
+
|
|
6
|
+
function isEmptyPlainObject(value) {
|
|
7
|
+
if (typeof value !== "object" || value === null) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const prototype = Object.getPrototypeOf(value);
|
|
11
|
+
const plain = prototype === null || Object.getPrototypeOf(prototype) === null;
|
|
12
|
+
return plain && Object.keys(value).length === 0;
|
|
13
|
+
}
|
|
14
|
+
function isMissingInstance(result) {
|
|
15
|
+
return result.ready === false && isEmptyPlainObject(result.i18n);
|
|
16
|
+
}
|
|
17
|
+
var NO_FIELDS = {};
|
|
18
|
+
function useHostI18next() {
|
|
19
|
+
const result = reactI18next.useTranslation();
|
|
20
|
+
if (isMissingInstance(result)) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const { t, i18n } = result;
|
|
24
|
+
return {
|
|
25
|
+
t,
|
|
26
|
+
i18n: typeof i18n === "object" && i18n !== null ? i18n : NO_FIELDS
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
chunk6GFSF2ML_js.registerHostI18next(useHostI18next);
|
|
Binary file
|
|
Binary file
|